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 darkhog · Sep 19, 2013 at 07:24 AM · animationblender

Playing door animation doesn't work.

Following script: using UnityEngine; using System.Collections;

 public class DoorToggle : MonoBehaviour {
     private bool doorOpen = false;
     
     // Use this for initialization
     void Start () {
     
     }
     void OnMouseUpAsButton () {
         if (doorOpen) {
             gameObject.animation.Play("Close");
         }
         else {
             gameObject.animation.Play("Open");
             
         }
         doorOpen = !doorOpen;
     }
     void OnGUI() {
         GUI.Box(new Rect(32,32,100,24),doorOpen.ToString());
     }
     
     // Update is called once per frame
     void Update () {
     
     }
 }

doesn't work. Code gets executed as doorOpen is changing values, but it doesn't work.

Door were animated in Blender, closing/opening animations are like 60 frames (1sec). I've tried to use Play, PlayQueued and even crossfade, none of these are working.

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 Lovrenc · Sep 19, 2013 at 07:35 AM 1
Share
  1. Have you imported animations from blender?

  2. do you see them in inspector/do the work?

  3. Did you split the animation from blender?

  4. Not sure, but maby capitalization matters. Check the names of animations.

avatar image meat5000 ♦ · Sep 19, 2013 at 07:45 AM 1
Share

Try leaving out 'gameObject.' from your animation call.

avatar image darkhog · Sep 19, 2013 at 09:47 AM 1
Share

@Lovrenc

  1. Yes, I did.

  2. Yes.

  3. Yes, though I'm not sure if I did it correctly. From 1 (key frame, kf) frame to 60 (kf) there is opening animation (just rotating by 90), from 61 to 120(kf) there is closing animation. Then I manually split animation into "Open" and "Close" animation under animations tab (aside of that all settings are default)

  4. Capitalization was first thing I check. It is Open and Close (first capital letter) and was correct.

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by YoungDeveloper · Sep 19, 2013 at 07:51 AM

Try switching the animation type to Legacy, It's located in objects inspector Rig tab.

Comment
Add comment · Show 3 · 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 darkhog · Sep 19, 2013 at 09:43 AM 0
Share

Tried that, made it worse (door either turned invisible or moved so faar that they could be just as well invisible). I'm always trying to search/solve problems on my own before posting, but this issue is bugging me.

avatar image YoungDeveloper · Sep 19, 2013 at 09:50 AM 0
Share

Try running On$$anonymous$$ouseUpAsButton (); in start function, see if that works, if yes, the problem is in registering mouse activity.

avatar image darkhog · Sep 19, 2013 at 09:54 AM 0
Share

If you missed that (no sarcasm or insult intended), I've already checked if On$$anonymous$$ouseUpAsButton gets executed and it does (doorOpen bool changes value when door are clicked (as seen in debug gui I've made inside script), and doorOpen is only changed in On$$anonymous$$ouseUpAsButton.

avatar image
1

Answer by clunk47 · Sep 19, 2013 at 05:00 PM

Be sure that before importing to Unity: In Blender, select your door object, hit CTRL + A, then apply Rotation and Scale. Then use Legacy Rig, under Generation, select Store In Root(New).

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

19 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

Related Questions

Children won't animate 2 Answers

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

What exactly can i do with Mecanim? 1 Answer

Importing assets 0 Answers

Animation Problems 1 Answer


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