Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
1 capture
11 Jun 22 - 11 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by Rosencrantz · Jul 19, 2015 at 01:16 AM · animatoranimator controllerasset bundles

Animator Controller created by script is not recognized by Animator

Hey everybody, I seem to be having trouble creating an Animator Controller through script that the Animator will actually recognize.

A bit of context: I have a custom editor that allows me to add new entries to a list of NPCs that spawn in the game. In order to save a bit of time, I'm also having it create empty animations and an animator controller assets to use with the new characters. I do this with the following code:

 AssetDatabase.CreateAsset(new AnimatorController(),"Assets/Sprites/Unit Sprites/Animations and Controllers/New Unit Animation Controller.controller");

While this does indeed create a new controller, when attempting to open it in the Animator I'm greeted with "Cannot show controller from asset bundle".

I use a near identical script to create new animation assets without any problems, so I'm really not sure what I'm missing here?

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image HeyJoeLang · Oct 12, 2015 at 06:51 PM 0
Share

I have the same issue, when using the alternative function

CreateAnimatorControllerAtPath(string path)

or

CreateAnimatorControllerAtPathWithClip(string path, AnimationClip clip)

An object is created, but it is not recognized by the Editor. Because of this, I am unable to access the controller in the editor or modify it via an editor script. Does anyone know why this happens?

2 Replies

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by maxoulaf · Dec 02, 2016 at 06:26 PM

I just had the problem and found out that it was only because the controller created by script does not have any layer.

You can fix it either by adding manually a new layer after you've created your controller, or adding this code :

  AnimatorController controller = new AnimatorController();
  controller.AddLayer("Base Layer");
  AssetDatabase.CreateAsset(controller, pathNewAnimator + ".controller");



Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
1

Answer by HeyJoeLang · Oct 13, 2015 at 11:29 AM

I found the answer. It was much simpler than I was making it out to be. The datatype is not assumed when the function is called. You have to add ".controller" to the end of the path.

For example:

UnityEditor.Animations.AnimatorController controller = UnityEditor.Animations.AnimatorController.CreateAnimatorControllerAtPath("Assets/AC");

should instead be:

UnityEditor.Animations.AnimatorController controller = UnityEditor.Animations.AnimatorController.CreateAnimatorControllerAtPath("Assets/AC.controller");

Hope this helps.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Loading Animations from Asset Bundle 2 Answers

Set the time of an animation keyframe per script? 0 Answers

Check Animator State Animation Completed 0 Answers

How to get Animation Clip timeline values from code 1 Answer

Animator stops working after updating to 5.6 3 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges