private GameObject InjectDependencies([NotNull] GameObject obj) { if (obj == null) { throw new ArgumentNullException(nameof(obj)); } InjectionStrategy.InjectDependencies <MonoBehaviour>(InjecteeLocator <MonoBehaviour> .Create(obj), ResolverService); return(obj); }
public GameObject Create([NotNull] GameObject prefab, Vector3 position, Quaternion rotation) { if (prefab == null) { throw new ArgumentNullException(nameof(prefab)); } GameObject obj = GameObject.Instantiate(prefab, position, rotation) as GameObject; //Decorate the current resolver with one that uses the contextual services IResolver resolver = new ContextualDependencyResolverDecorator(ResolverService, ServiceMap); //Inject using the decorated resolver InjectionStrategy.InjectDependencies <MonoBehaviour>(InjecteeLocator <MonoBehaviour> .Create(obj), resolver); return(obj); }