Beispiel #1
0
        protected override void GetInjectableMonoBehaviours(List <MonoBehaviour> monoBehaviours)
        {
            UniDiUtilInternal.AddStateMachineBehaviourAutoInjectersUnderGameObject(gameObject);

            // We inject on all components on the root except ourself
            foreach (var monoBehaviour in GetComponents <MonoBehaviour>())
            {
                if (monoBehaviour == null)
                {
                    // Missing script
                    continue;
                }

                if (!UniDiUtilInternal.IsInjectableMonoBehaviourType(monoBehaviour.GetType()))
                {
                    continue;
                }

                if (monoBehaviour == this)
                {
                    continue;
                }

                monoBehaviours.Add(monoBehaviour);
            }

            for (int i = 0; i < transform.childCount; i++)
            {
                var child = transform.GetChild(i);

                if (child != null)
                {
                    UniDiUtilInternal.GetInjectableMonoBehavioursUnderGameObject(
                        child.gameObject, monoBehaviours);
                }
            }
        }
Beispiel #2
0
 protected override void GetInjectableMonoBehaviours(List <MonoBehaviour> monoBehaviours)
 {
     UniDiUtilInternal.AddStateMachineBehaviourAutoInjectersUnderGameObject(gameObject);
     UniDiUtilInternal.GetInjectableMonoBehavioursUnderGameObject(gameObject, monoBehaviours);
 }