Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
0
Question by Captain_Dando · Jan 30, 2013 at 11:05 AM · animationblender

Blender model animations not found after import

Hi everyone, I have a model that is the second I've create for my game. The first, I was able to import into unity with it's animations already attached with an animation component, but my second model imports without them. in addition, if I add the animation component in and drag the animations on to it, unity still can't find it in game. I get the following error;

 The animation state Open could not be played because it couldn't be found!
 Please attach an animation clip with the name 'Open' or call this function only for existing animations.
 UnityEngine.Animation:Play(String)
 Chest:Open() (at Assets/Scripts/Chest.cs:39)
 Chest:OnMouseUp() (at Assets/Scripts/Chest.cs:31)
 UnityEngine.SendMouseEvents:DoSendMouseEvents(Int32, Int32)

I'm not sure if this problem is due to unity or blender. this is how my animation work space appears prior to a save (I open my models in blender as .blends)

Update: I've since tried to export it as an .obj file, but the problem remains, so it can't be due to the .blend format

alt text

Here is the object in game

alt text

And here is the code that uses the animation;

 using UnityEngine;
 using System.Collections;
 
 public class Chest : MonoBehaviour {
     public enum State {
         open,
         close,
         inbetween
     }
     public State _state;
     
     // Use this for initialization
     void Start () {
         _state = Chest.State.close;
     }
     
     // Update is called once per frame
     void Update () {
     
     }
     
     public void OnMouseEnter() {
         Debug.Log("enter");
     }
     public void OnMouseExit() {
         Debug.Log("exit");
     }
     public void OnMouseUp() {
         Debug.Log("Up");
         if (_state == Chest.State.close){
             Open ();
         }
         else{
             Close();
         }
     }
     
     private void Open(){
         animation.Play("Open");
         _state = Chest.State.open;
     }
     private void Close(){
         animation.Play("Close");
         _state = Chest.State.close;
     }
 }

import_problems2.jpg (310.4 kB)
import_problems.jpg (478.7 kB)
Comment
Add comment · Show 3
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 Paulo-Henrique025 · Jan 30, 2013 at 11:46 AM 1
Share

The .blend is fine, there is something wrong inside the Edtior, please post a screenshot of your model selected inside the editor. Also, .obj model have no animation, only mesh/uv data.

avatar image Adam-Buckner ♦♦ · Jan 30, 2013 at 11:51 AM 1
Share

What are you import settings?

Don't forget, if you are using 4.x that the importer now has 3 tabs and you need to check the settings on all 3.

ScreenShots of those 3 windows would help.

avatar image Captain_Dando · Jan 30, 2013 at 11:57 AM 0
Share

@Paulo Henrique Thanks, I've included a screenshot of the object's property in the question.

@Little Angel do you mean import options on each animation? that's a good point, the first model was added when I was still using 3.x

3 Replies

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

Answer by Captain_Dando · Jan 30, 2013 at 12:59 PM

Ok, it turns out that if you have a project that transfers from version 3.x you might have to change the animations to "legacy" animations under import settings for the model's armature. After that, it should work perfectly.

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 Adam-Buckner · Jan 30, 2013 at 12:15 PM

Currently that animation component has no animation clip assigned, but 3 clips available.

Are you selecting the clip to play?

Animation Component in the docs

Animation.Play() in the docs

If you simply use Animation.Play() there is no default animation to play. If this is the case, you'd want to say: Animation.Play ("Open"); for example

If this isn't the answer you are looking for, can you post your code?

Comment
Add comment · Show 2 · 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 Captain_Dando · Jan 30, 2013 at 12:23 PM 0
Share

I've been using Animation.Play("Open") already :( I've included the code into my question

avatar image Captain_Dando · Jan 30, 2013 at 12:47 PM 0
Share

I forgot to mention, I added the animations manually to the animation component, I usually add the animation clip as idle, but didnt this time, nevertheless it doesn't really change it

avatar image
1

Answer by Adam-Buckner · Jan 30, 2013 at 12:48 PM

FWIW: When I animated a chest lid, I set the default animation to Open, and then played Open to open the chest and played Open backwards to close it, so there was only one animation:

 public void LootWindowToggle (bool toggle) {                                    //    A setter to set the lootPanelOpen to closed and stop TestDistance
     lootPanelOpen = toggle;
     PlayAnimation (toggle);                                                        //    Is this the correct location?
 }
 
 protected void PlayAnimation (bool toggle) {
     if (thisAnimation) {
         if (toggle) {
             foreach (AnimationState state in thisAnimation) {
                 if (state.normalizedTime < 0.0f)
                     state.normalizedTime = 0.0f;
                 state.speed = 1.0f;
             }
         } else {
             foreach (AnimationState state in thisAnimation) {
                 if (state.normalizedTime > 1.0f)
                     state.normalizedTime = 1.0f;
                 state.speed = -1.0f;
             }
         }
         
         thisAnimation.Play();
     }
 }
Comment
Add comment · Show 2 · 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 Adam-Buckner ♦♦ · Jan 30, 2013 at 12:55 PM 1
Share

The one major advantage to this way of doing things is that you can reverse the animation while it is in progress

You can see this in action here.

The windows will get in the way in the current view so open a chest, then close the window on top. The you can start to close and reopen the lid and see that the animation simply reverses.

$$anonymous$$oreover, you can tie it into the state of the object, so you can click on the other chest and the first one will close.

avatar image Captain_Dando · Jan 30, 2013 at 12:58 PM 0
Share

I just fiddled around with the importer for a bit and it turns out that I had to change the animations to "legacy" under rigs. I'm going to post it as the reply, but thank you for all the help, you've given me a few new methods to work with, and you set me in the right direction to find the solution

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

11 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

Related Questions

Children won't animate 2 Answers

Blender to Unity - Child Of Bone Constraint With FPS Reload Animation 0 Answers

Importing assets 0 Answers

Animation Problems 1 Answer

Can Unity import un-rigged animations from blender? 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