Пример #1
0
 private void Start()
 {
     Debug.Log($"FooChildOfChildController::Start() - {fooService1.FooService1Api()}");
     // Console output: FooChildOfChildController::Start() - This is FooService1.My HashCode is -3164
     Debug.Log($"FooChildOfChildController::Start() - {fooService2.FooService2Api()}");
     // Console output: FooChildOfChildController::Start() - This is FooService2.My HashCode is -3182
 }
Пример #2
0
        private void Start()
        {
            Debug.Log($"FooChildController::Start() - {fooService1.FooService1Api()}");
            // Console output: FooChildController::Start() - This is FooService1.My HashCode is -3164
            Debug.Log($"FooChildController::Start() - {fooService2.FooService2Api()}");
            // Console output: FooChildController::Start() - This is FooService2.My HashCode is -3182

            AddChild <FooChildOfChildController>(b =>
            {
                b.RegisterInstance(fooService2).As <IFooService2>();
            });
        }
Пример #3
0
        private void Start()
        {
            Debug.Log($"FooController::Start() - {fooService1.FooService1Api()}");
            // Console output: FooController::Start() - This is FooService1. My HashCode is -2676
            Debug.Log($"FooController::Start() - {fooService2.FooService2Api()}");
            // Console output: FooController::Start() - This is FooService2.My HashCode is -3170

            // AddChild<FooChildController> method does:
            // 1. Attaches child gameobject to this.gameObject
            // 2. Adds FooChildController component to child gameobject
            // Pay attension, 'AddChild' method doesn't attach ComponentContext to the child gameobject since it makes no sense with no custom configuration.
            AddChild <FooChildController>();
        }