isb
isb copied to clipboard
Enable library developers to access to the lib instance or inject argument objects to it during runtime
So far custom libraries are instantiated only with Activator.CreateInstance(libClass); and the library creator has no straightforward way to access the library instance.
Given the current implementation, it's a bit hard for library developers to inject objects to the library instance in runtime (considering in a Unity game the GameManager instance needs to be passed in). Possible ways include using a singleton (global) as the proxy, etc. Instead, the following solutions could be way better and worth being considered:
- Enable lib creators to instantiate the lib with passed-in arguments. Or,
- Enable lib creators to inject argument objects to a lib instance during runtime. Or,
- Let lib creators define a Context class type and associate an instance of the Context type with the lib instance. Or,
- Let lib creators define their own logic (as a callback closure) to instantiate the lib. Or,
- ...
Hallo, is this still in the works? Right now I'd be very interested in being able to access a library instance (just so I can inject the object that my Engine is "attached" to).
Hallo, is this still in the works? Right now I'd be very interested in being able to access a library instance (just so I can inject the object that my Engine is "attached" to).
Ah, yes, it is still in the plan. My bandwidth has been occupied with other tasks. I will try to make time to complete this.
Please take as much time as you need, there is no hurry. Right now I'm just using a static variable as a workaround and it works well enough.