For the third term at Level 5 of my Computer Games Programming (BSc) degree at University of Staffordshire, I had a Tools Development module where I was tasked with creating a tool that aids some part of the creation of games. There was a few options to choose from but I chose to create an in-engine tool for Unity, created in C#.
Tool Idea
The idea I chose to pursue was a code manager / decoupler that helped separation of concerns for game scripts, allowing them to be more reusable. This would help prototyping and faster development, with larger scoped projects possibly requiring less separation due to optimisation needs. In particular, this tool helped combat the over reliance of singletons within Unity development. To create said tool I created a Kanban board on Trello to aid with project management.
Scriptable Objects
Main functionality of the tool utilised Scriptable Objects to store data that can be read from and written to. This allows a component to use a value that can be changed by other components, without either knowing about the other. For example, a character can update a health value, which a health UI component can use to display the current health value.
The created Scriptable Object types created are:
- Variables and references to use like mentioned above
- Events and event listeners using the in-built Unity event system
- Collections to store lists of data (such as a list of alive enemies)
The combination of these types gives a lot of flexibility to create reusable components which can be combined in different ways to build up playable game prototypes.
Debugging
One of the biggest drawbacks in utilising Scriptable Objects in this way is the bigger difficulty to debug as it can be harder to tell where the values are being changed and acquired from. To solve this lots of debugging options were added, such as, a debug output when a variable is updated, ability to fire the events with a custom debug value from the inspector, and debug output when items are added or removed from a collection.
User Interface
Another main feature of the tool that would help debug and use the Scriptable Objects is the creation of UI for tracking references to the Scriptable Objects, which updated when required.
Code Manager README created for assisting with usage talks about features further.