01. What Is Inity

  01. Introduction No Comments

Inity is a seamlessly integrated and type safe framework for providing your Components and ScriptableObjects with their dependencies.

Main Features

  • Add Component with arguments.
  • Instantiate with arguments.
  • Create Instance with arguments.
  • new GameObject with arguments.
  • Service framework (a powerful alternative to Singletons).
  • Wrapper system (attach plain old class objects to GameObjects).
  • Auto-Initialization support.
  • Assigning to read-only fields and properties.
  • Type safety thanks to use of generics.
  • Reflection-free dependency injection.

Introduction

Did you ever wish you could just call Add Component with arguments like this:

Player player = gameObject.AddComponent<Player, IInputManager>(inputManager);

Or maybe you’ve sometimes wished you could Instantiate with arguments like so:

Player player = playerPrefab.Instantiate(inputManager);

And wouldn’t it be great if you could create ScriptableObject instances with arguments as well:

DialogueAsset dialogue = Create.Instance<DialogueAsset, Guid>(id);

This is precisely what Inity let’s you do! All you need to do is derive your class from one of the generic MonoBehaviour<T…> base classes, and you’ll be able to receive upto five arguments in your Init function.

In cases where you can’t derive from a base class you can also implement the IInitializable<T> interface and manually handle receiving the arguments with a single line of code (see the InitArgs section of the documentation for more details).

Leave a Reply

Your email address will not be published. Required fields are marked *