public static DevelopmentAnimatorObject Load() { DevelopmentAnimatorObject settings = AssetDatabase.LoadAssetAtPath <DevelopmentAnimatorObject>(PATH); if (settings != null) { return(settings); } if (!AssetDatabase.IsValidFolder(FOLDER)) { if (!AssetDatabase.IsValidFolder("Assets/" + Constants.PACKAGES_SETTINGS_FOLDER)) { AssetDatabase.CreateFolder("Assets", Constants.PACKAGES_SETTINGS_FOLDER); } AssetDatabase.CreateFolder( "Assets/" + Constants.PACKAGES_SETTINGS_FOLDER, Constants.SETTINGS_FOLDER); } settings = CreateInstance <DevelopmentAnimatorObject>(); AssetDatabase.CreateAsset(settings, PATH); AssetDatabase.SaveAssets(); return(settings); }
private void LoadResources() { GameObject selection = Selection.activeGameObject; _developmentAnimatorObject = DevelopmentAnimatorObject.Load(); _developmentAnimatorItem = _developmentAnimatorObject.GetSelectedAnimator(selection); if (_developmentAnimatorItem == null) { _isAnimator = false; return; } _isAnimator = true; int animatorInstanceID = selection.GetComponent <Animator>().runtimeAnimatorController.GetInstanceID(); int ogInstanceID = _developmentAnimatorItem.originalController.GetInstanceID(); _selectedController = (ogInstanceID == animatorInstanceID) ? SelectedController.Original : SelectedController.Development; Assert.IsNotNull(_developmentAnimatorItem.originalController); _originalAnimatorClips = _developmentAnimatorItem.originalController.animationClips; _ogAnimatorController = AssetDatabase.LoadAssetAtPath <AnimatorController>( AssetDatabase.GetAssetPath( _developmentAnimatorItem.originalController.GetInstanceID() ) ); if (_developmentAnimatorItem.developmentController != null) { _developmentAnimatorClips = _developmentAnimatorItem.developmentController.animationClips; _devAnimatorController = AssetDatabase.LoadAssetAtPath <AnimatorController>( AssetDatabase.GetAssetPath( _developmentAnimatorItem.developmentController.GetInstanceID() ) ); } }