- Home /
Animator Editor Window disappear when generate AnimatorController inside other asset
Hi Everyone,
Currently I trying to grouping some resource under an asset, I get the idea from group the animation clips under one animatorController.
I create an asset from scriptableObject, then I create an animatorController from editorScript, next I add it to the scriptable asset I've created before, everything seem to be ok until I reset unity (close then open Unity again), my animatorController which is under the that scriptableObject got problem!!! The animator window not display the state edit grid, everything inside this animatorController was Disappear. :O
Here is my asset creation script:
private void CreateGroupObject() {
string assetPath = GetGroupObjectAssetPath();
if (File.Exists(assetPath)) {
return;
}
RoomRACTemplateGroupAsset roomRACTemplateGrp = ScriptableObject.CreateInstance<RoomRACTemplateGroupAsset>();
AssetDatabase.CreateAsset(roomRACTemplateGrp, assetPath);
AssetDatabase.SetLabels(roomRACTemplateGrp, new[] {EditorSupportToolConfig.AL_CharRACTemplateGrp});
roomRACTemplateGrp.UpdateDescription(m_createType);
roomRACTemplateGrp.UpdateDetails();
}
Here is my creation animatorController script:
private AnimatorController CreateRAC() {
RoomRACTemplateGroupAsset grpAsset = AssetDatabase.LoadAssetAtPath<RoomRACTemplateGroupAsset>(assetPath);
var controller = new AnimatorController {name = controllerName};
controller.AddLayer("Base Layer");
AssetDatabase.AddObjectToAsset(controller, grpAsset);
EditorUtility.SetDirty(grpAsset);
AssetDatabase.SaveAssets();
if (labels != null) {
AssetDatabase.SetLabels(controller, labels);
}
return controller;
}
Note: I've tested this, but I got error it's say that I can not add an asset to other asset. Code (csharp): AnimatorController.CreateAnimatorControllerAtPath(path); This is what I've got after do this
This is my asset structure
I have googled and it's seem no help. If I have missed something help please light up my way...
Thanks for spending time to support me. p.s: I still new in EditorScript
Your answer
![](https://koobas.hobune.stream/wayback/20220612131128im_/https://answers.unity.com/themes/thub/images/avi.jpg)