Exemplo n.º 1
0
        protected override IEnumerable <Component> GetInjectableComponents()
        {
            // We inject on all components on the root except ourself
            foreach (var component in GetComponents <Component>())
            {
                if (component == null)
                {
                    Log.Warn("Zenject: Found null component on game object '{0}'.  Possible missing script.", gameObject.name);
                    continue;
                }

                if (component.GetType().DerivesFrom <MonoInstaller>())
                {
                    // Do not inject on installers since these are always injected before they are installed
                    continue;
                }

                if (component == this)
                {
                    continue;
                }

                yield return(component);
            }

            foreach (var gameObject in UnityUtil.GetDirectChildren(this.gameObject))
            {
                foreach (var component in ContextUtil.GetInjectableComponents(gameObject))
                {
                    yield return(component);
                }
            }
        }
Exemplo n.º 2
0
 protected override IEnumerable <Component> GetInjectableComponents()
 {
     return(ContextUtil.GetInjectableComponents(this.gameObject.scene));
 }