Category : 04. Features

Opening The Service Debugger Window You can open the Service Debugger Window using the main menu item Window > Analysis > Service Debugger. Using The Service Debugger Window The window lists all currently active services, which have been registered via ServiceAttributes, Service Tags and Services Components. The first name shown in the list is the ..

Read more

Init(args) contains new generic versions of the StateMachineBehaviour base class, extending it with the ability to receive up to six objects during initialization. For example the following AttackBehaviour class depends on an object that implements the IAttackable interface and a ScriptableObject asset of type AttackBehaviourSettings: public class AttackBehaviour : StateMachineBehaviour<IAttackable, AttackBehaviourSettings> When you create a ..

Read more

Init(args) has been designed with inversion of control in mind and aims to make it as easy as possible to work with interfaces instead of specific classes in Unity. One pain point when using interfaces in Unity is that checking them for null can be problematic. This is because in addition to being actually null, ..

Read more

A base class for MonoBehaviours that depend on receiving upto six objects in their constructor during initialization. For example the following Player class depends on an object that implements the IInputManager interface and an object of type Camera. public class Player : ConstructorBehaviour<IInputManager, Camera> When you create a component that inherits from one of the ..

Read more

Sometimes you may want to make use of read-only fields or get-only properties in your components and scriptable objects. Read-only members make your data immutable and as such result in code that is less prone to errors and fully thread safe without needing any complicated thread locking. The issue is that you can’t pass any ..

Read more

The generic GameObject structs are builder that can be used to initialize a GameObject and upto three components in a single line of code. If you want a GameObject with a single component to be build, initialize a new instance of the GameObject<T> struct and specify the type of the component you want attached to ..

Read more

The Find class is a utility class that helps in locating instances of objects from loaded scenes as well as assets from the project. It has been designed from the ground up to work well with interface types, making it easier to decouple your code from specific concrete classes. All methods in the Find class ..

Read more

The ScriptableWrapper class is a ScriptableObject that can act as a simple wrapper for a plain old class object. It makes it easy to take a plain old class object and serialize it as an asset in the project. Let’s say you had a plain old class called Settings: public class Settings { public float ..

Read more

The Wrapper class is a component that acts as a simple wrapper for a plain old C# object. It makes it easy to take a plain old C# object and attach it to a GameObject and have it receive callbacks during any Unity events you care about such as Update or OnDestroy as well as ..

Read more

When a component that derives from MonoBehaviour<T> and has the InitOnResetAttribute is first added to a GameObject in the editor, or when the user hits the Reset button in the Inspector’s context menu, the arguments accepted by the component are automatically gathered and passed to its Init function. This auto-initialization behaviour only occurs in edit ..

Read more