Exemplo n.º 1
0
    internal VisualObject Init(object obj)
    {
        Obj       = obj;
        _animator = gameObject.GetComponent <Animator>();
        if (_animator == null)
        {
            _animator = gameObject.GetComponentInChildren <Animator>();
        }
        VisualPrefab = _animator?.gameObject;
        var vo = new VisualObject(obj, Destroy);

        foreach (var setup in gameObject.GetComponentsInChildren <VisualSetup>())
        {
            setup.Visual = this;
            var c = setup.GetOrCreate(obj);
            c.Parent = obj;
            vo.AddChild(c);
        }
        return(vo);
    }