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 /
This question was closed Aug 19, 2012 at 12:01 PM by KiraSensei for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by KiraSensei · Aug 02, 2012 at 10:33 PM · animationprefabmaya

Prefab animation problem

Hi everyone !

I'm not sure if it's the right place to ask my question (I hesitated with a Maya forum), but I'll try ...

I have a problem with a prefab made with a maya model. When I try to instantiate it in a specific position and animate it, it moves instantly to origin and play the animation. But if I delete the animation line, the game object stays where it should be. I don't have this problem with an other prefab. The code is the same, only the maya model is different. I have a skeleton in the second model, contrary t the first one, I don't know if it's the problem ...

Comment
Add comment
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

3 Replies

  • Sort: 
avatar image
0
Best Answer

Answer by KiraSensei · Aug 03, 2012 at 04:01 PM

I found my problem : the issue was the skeleton ! I added one joint (yes, only one, very useful ...) to my model, moved the animation from my geometry to my joint and here it works ! An other problem now is that I need to attach a box collider to my prefabs, and if there is at least a joint, the box collider does not follow the animation. I don't know why, and for the moment and in my game this is not important. If someone has an idea why there are these weird problems, let me know :)

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
0

Answer by MKlegoman357 · Aug 03, 2012 at 12:30 AM

You should make an empty game object that should be parent of your made and animated object. This empty game object must have all scripts that is made to your game object.

To run an animation of your game object you have to make a variable that is type of GameObject and would be your game object. use this (javascript):

var myObject : GameObject; //your game object that has animation

var myAnimation : String; //your animation name

//when you want to run animation do this:

myObject.animation.Play(myAnimation);

this is working even when you are changing the transform of the empty game object.

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 KiraSensei · Aug 03, 2012 at 06:38 AM 0
Share

I already have done that, this is not the problem. $$anonymous$$y problem is that I have two prefabs from maya, and a different behavior when I try to instantiate them (by code), and I don't understand why. The code is exactly the same, but not the prefabs ...

avatar image MKlegoman357 · Aug 03, 2012 at 02:17 PM 0
Share

try to reimport the object or remake animation. I think there can be a problem when you change the scale of an object. $$anonymous$$aybe you could try to reemport the object(don't change scale) make an empty game object that would be parent of your game object and then rescale empty game object.

avatar image KiraSensei · Aug 03, 2012 at 02:26 PM 0
Share

I'll try to reimport it or recreate the animation, but I don't really think it will be better. I already have an empty object that contains this game object, it contains also other gameobjects (like the other one which has no problem with its animation ...), so i can't rescale the parent.

avatar image
0

Answer by MKlegoman357 · Aug 03, 2012 at 12:30 AM

You should make an empty game object that should be parent of your made and animated object. This empty game object must have all scripts that is made to your game object.

To run an animation of your game object you have to make a variable that is type of GameObject and would be your game object. use this (javascript):

var myObject : GameObject; //your game object that has animation

var myAnimation : String; //your animation name

//when you want to run animation do this:

myObject.animation.

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

Follow this Question

Answers Answers and Comments

8 People are following this question.

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

Related Questions

Can I make animations snap to a frame? 1 Answer

How to make changes to FBX without breaking Prefabs? 1 Answer

A Prefab with animation.Play doesnt work 0 Answers

Play animation serially imported from Maya to Unity 1 Answer

Import animation from Maya 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