Mathijs-Bakker / Extenject

Dependency Injection Framework for Unity Game Engine
MIT License
514 stars 96 forks source link

Ignore all types in UnityEngine namespace #8

Open pnarimani opened 3 years ago

pnarimani commented 3 years ago

Currently TypeAnalyzer class tries to get type info of all classes that are in UnityEngine namespaces. I think this is a waste of time since no component or behaviour in UnityEngine namespace uses injection.

I created this issue to discuss this potential change and see if anything breaks if we ignore everything from Unity.

SolidAlloy commented 3 years ago

Instead of checking each class for its namespace, we can filter UnityEngine/UnityEditor assemblies, skipping them altogether.

Assemblies whose names start with "System." should also be skipped then. It is unlikely there are any custom assemblies that use Zenject and are named this way.

pnarimani commented 2 years ago

Instead of checking each class for its namespace, we can filter UnityEngine/UnityEditor assemblies, skipping them altogether.

Assemblies whose names start with "System." should also be skipped then. It is unlikely there are any custom assemblies that use Zenject and are named this way.

The important thing about this issue is that you cannot instantiate things that you ignore. I assume that nobody is going to use InstantiateExplicit on Unity components. But with System classes is a little bit tricky.