Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
avatar image
0
Question by McGravity · Jan 04, 2017 at 03:24 PM · animatorassetbundleanimator controller

Load AnimatorController from AssetBundle as RuntimeAnimatorController.

Hi,

I'm using Unity 5.5.0p3 on Windows 7 and this is how I currently try to dynamically load AnimatorControllers from an AssetBundle:

 RuntimeAnimatorController tmpController = assetBundle.LoadAsset("MyAnimController") as 
     RuntimeAnimatorController;
 RuntimeAnimatorController controller = Instantiate(tmpController);

When I do so, I get the following warning when using it as the RuntimeAnimatorController for an Animator component:

The Animator Controller (MyAnimController) you have used is not valid. Animations will not play

The Animator is initialized, valid and I apply the controller like this:

 myAnimator.runtimeAnimatorController = controller;

From debugging I can see that the AnimatorController, after loading it from the AssetBundle, has no layers or parameters whatsoever. Which is obviously not the case when viewed from the editor. It has a "Base Layer" and two parameters.

Weird enough it does work when I don't Instantiate the AnimatorController, but use it directly from the AssetBundle:

 myAnimator.runtimeAnimatorController = assetBundle.LoadAsset("MyAnimController") as 
     RuntimeAnimatorController;

That on the other hand leads to a silent crash of Unity when calling the GetBehaviours() method.

This is how I create the AssetBundle:

 BuildPipeline.BuildAssetBundles("Assets/AssetBundles", BuildAssetBundleOptions.None, 
     BuildTarget.StandaloneWindows64);
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 Arvin6 · Aug 22, 2017 at 10:30 AM 0
Share

Hello, Did you solve this issue?

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by rahul-ahuja79 · Sep 12, 2017 at 06:33 AM

RuntimeAnimatorController controller = Instantiate(tmpController); Dont instantoiate it just put directly RuntimeAnimatorController tmpController = assetBundle.LoadAsset("MyAnimController") as RuntimeAnimatorController;

myAnimator.runtimeAnimatorController = tmpController;

Your animation will be played smoothly .

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

96 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

AnimationClip length always equal 1 when prefeb is loaded from assetbundle with Unity5.3.2p1 1 Answer

I'm trying to animate a chest opening and closing, but the opening and closing animations aren't playing when they should. 1 Answer

how i can set attack back to false ? 0 Answers

How to Apply Animation to Player 0 Answers

Animator doesn't change animation in Update() function 0 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