Skip to content

A Simple IoC container used for my Unity projects. Designed to work with il2cpp.

License

Notifications You must be signed in to change notification settings

JochenHeckl/IoCLight

Repository files navigation

IoCLight

IoCLight is a minimal IoC Container for the Unity Game Engine. IoCLight is designed to work with il2cpp.

Find the Quick Start Guide here;

Motivation:

I found Inversion of Control Containers to be a very simple to apply, yet effective, way to keep code structured and clean. I'm used to tools like Autofac, Ninject, Unity (The IoC Container) and alike, and I used them heavily in the past.

So why would I go write my own?

Well I tried some of the ones mentioned above in Unity projects, but was never really pleased with how they fit into Unity. It was only recently when I hit a hard wall porting a game to Android. The project used Autofac. It failed at runtime due to il2cpp not being able to deal correctly with C# Expressions.

After digging into the problem and finding no applicable solution or alternative for quite a while I finally replaced Autofac with {a}adic. which I can highly recommend if you need something that works with Android using il2cpp as backend!

When I started looking into building custom packages for the Unity Package Manager, I figured rolling a very simple IoC Container as a custom package - just for science - might be a nice little piece of work to learn about building custom packages... and here we go.

Feedback and contributions are welcome!

Have fun using IoCLight!