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 xexito · Jan 26, 2013 at 11:33 PM · animationmodel

Script refering to more than one GameObject

Hello, I have a JavaScript that I use to change the text color of a 3D Text and it will be used to close the application later. Here is the code:

 function OnMouseEnter()
 {
 renderer.material.color = Color.red;
 }
 
 function OnMouseExit()
 {
 renderer.material.color = Color.white;
 }
 
 function OnMouseUp()
 {
 
 }

This script is a component of a 3D text. I also have 3 .c4d files on my project. Each one contains a model (it's a bear) and a animation (made in Cinema 4D). The 2 animations are: Idle (like breathing) and death. I used the idle .c4d file to put the bear on the scene and the animation that was on that .c4d. On the other .c4d file, there is other animation, a death animation. What I want is that when "OnMouseUp()" occurs, the animation from the second .c4d (death) starts and then the application quit. I know I close the aplication with "Application.Quit();", what I want to know is how to create the stuff I texted here before.

Thanks in advance.

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by jogo13 · Jan 27, 2013 at 04:17 AM

You may want export the both animations onto the same model file. If you know the names of the animations you can play them like so.

 var bear_animation = bearGameObject.GetComponent("Animation");
 //you can play animations like so:
 bear_animation.Play("idle");
 //change it to death:
 bear_animation.Play("death");
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 xexito · Jan 27, 2013 at 09:40 AM 0
Share

I downloaded the .c4d files (there are 33, I didn't create anyone, because I really can't do anything that looks good). How can I export the animations onto the same file in Cinema 4D? I'm starting with Unity and Cinema 4D (started 2 days ago).

avatar image jogo13 · Jan 27, 2013 at 05:50 PM 0
Share

I don't know how to use Cinema 4D, but it looks like you can add multiple animations to one model's Animation component using Animation.AddClip http://docs.unity3d.com/Documentation/ScriptReference/Animation.AddClip.html

avatar image xexito · Jan 27, 2013 at 07:37 PM 0
Share

But only one model is on the scene. Can a model play an animation from other model?

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

10 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

Related Questions

(C#) Problem with animations not playing 1 Answer

2d Character physics? 1 Answer

Alternative To "SetEditorCurve"? 1 Answer

Stopping animation affecting physics 0 Answers

Animation play on input, else play idle animation. 2 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