Exemplo n.º 1
0
        internal static AnimatorController CreateAnimatorControllerForClip(AnimationClip clip, GameObject animatedObject)
        {
            string text = AssetDatabase.GetAssetPath(clip);

            if (string.IsNullOrEmpty(text))
            {
                return(null);
            }
            text = Path.Combine(FileUtil.DeleteLastPathNameComponent(text), animatedObject.name + ".controller");
            text = AssetDatabase.GenerateUniqueAssetPath(text);
            if (string.IsNullOrEmpty(text))
            {
                return(null);
            }
            return(AnimatorController.CreateAnimatorControllerAtPathWithClip(text, clip));
        }
Exemplo n.º 2
0
        internal static AnimatorController CreateAnimatorControllerForClip(AnimationClip clip, GameObject animatedObject)
        {
            string assetPath = AssetDatabase.GetAssetPath((UnityEngine.Object)clip);

            if (string.IsNullOrEmpty(assetPath))
            {
                return((AnimatorController)null);
            }
            string uniqueAssetPath = AssetDatabase.GenerateUniqueAssetPath(Path.Combine(FileUtil.DeleteLastPathNameComponent(assetPath), animatedObject.name + ".controller"));

            if (string.IsNullOrEmpty(uniqueAssetPath))
            {
                return((AnimatorController)null);
            }
            return(AnimatorController.CreateAnimatorControllerAtPathWithClip(uniqueAssetPath, clip));
        }