Ejemplo n.º 1
0
        public DevelopmentAnimatorItem GetSelectedAnimator(GameObject selected)
        {
            if (selected == null)
            {
                return(null);
            }

            DevelopmentAnimatorItem item = null;
            Animator animator            = selected.GetComponent <Animator>();

            if (animator == null || animator.runtimeAnimatorController == null)
            {
                return(null);
            }


            for (int i = 0; i < animatorsList.Count; i++)
            {
                int _originalID;
                int _developID;

                if (animatorsList[i].originalController != null)
                {
                    _originalID = animatorsList[i].originalController.GetInstanceID();
                    if (_originalID == animator.runtimeAnimatorController.GetInstanceID())
                    {
                        return(animatorsList[i]);
                    }
                }

                if (animatorsList[i].developmentController != null)
                {
                    _developID = animatorsList[i].developmentController.GetInstanceID();
                    if (_developID == animator.runtimeAnimatorController.GetInstanceID())
                    {
                        return(animatorsList[i]);
                    }
                }
            }

            if (item == null)
            {
                item = new DevelopmentAnimatorItem
                {
                    originalController = animator.runtimeAnimatorController
                };

                animatorsList.Add(item);
                EditorUtility.SetDirty(this);
                AssetDatabase.SaveAssets();
            }

            return(item);
        }
Ejemplo n.º 2
0
        public void SaveDevelopmentAnimatorItem(DevelopmentAnimatorItem item)
        {
            for (int i = 0; i < animatorsList.Count; i++)
            {
                if (item.originalController == animatorsList[i].originalController)
                {
                    animatorsList[i].developmentController = item.developmentController;
                    animatorsList[i].clipList = item.clipList;

                    EditorUtility.SetDirty(this);
                    AssetDatabase.SaveAssets();

                    return;
                }
            }
        }