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 post has been wikified, any user with enough reputation can edit it.
avatar image
0
Question by Ingen · Jul 08, 2012 at 10:57 PM · animationvar

load specific element of animation via var

Hallo, try to post my question in different way

maybe is better understood and will be answered

I will use this easy code, to activate all the animations of door, lift, and other who have two clip,

for exemple the door animation have OpenDoor and CloseDooor clips

the problem come when i try to load a specific clip from the door in this way is called the first clip only. OpenDoor

  var animatedObj1 : GameObject; // Dooor
   var animatedObj2 : GameObject; // Button
 
  function Active()
   {    
      animatedObj1.animation.Play();
       animatedObj2.animation.Play();
  } 
 

 I Try  
 
 >> var AnimcCip : AnimationCilp;
 to load specific clip OpenDoor or CloseDoor
 and various way to do but not work at all or   
 even  doesn't display any error loading the script
 receive that's error when play 
 
 NullReferenceException: Object reference not set to an instance of an object 
 
 CameraRayReciver1.js(13,74): BCE0048: Type 'System.Type' does not support slicing.
 
 if write directly the name of clip its work, but I need the var to reuse the script
 
 Thanks to all can help my

Comment
Add comment · Show 6
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 Ingen · Jul 09, 2012 at 01:24 PM 0
Share

F1! F1! no one can help me? pleaaase :) :)

avatar image Ingen · Jul 10, 2012 at 12:03 AM 0
Share

ok using var anim: AnimationClip;

I'm able to load OpenDoor o Close Door animation

but now receive ever thats error

NullReferenceException: Object reference not set to an instance of an object

CameraRayReciver1.js(13,74): BCE0048: Type 'System.Type' does not support slicing.

please someone give me help, I'm very stuck

thanks

avatar image Ingen · Jul 12, 2012 at 11:17 PM 0
Share

if it's impossible to do?

tell me!!! thanks

avatar image Ingen · Jul 13, 2012 at 11:44 AM 0
Share

nothing??? :( :( :( :(

avatar image Ingen · Jul 13, 2012 at 05:00 PM 0
Share

really need at least know if is possible

Thanks

Show more comments

2 Replies

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

Answer by whydoidoit · Jul 13, 2012 at 05:32 PM

You can load an animation using Animation.AddClip(yourClip,"nameOfClip") or Animation.AddClip(yourClip, yourClip.name)

Given a clip you can do

    animation.Play(clip.name);
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 Ingen · Jul 16, 2012 at 05:16 PM

thanks you

I've some trouble to use " Animation.AddClip "

but this answer put me on the way to do this

 var animatedObj1  : GameObject; // Dooor at plane 0  
 var animatedObj2 : GameObject; // Button
 var animatedObj3 : GameObject; // Lift 
 var animatedObj4 : GameObject; //Dooor at plane1 
      var anim1clip: AnimationClip ;   // Dooor at plane 0 close
      var anim3clip: AnimationClip ;// Lift go up
      var anim4clip: AnimationClip ;//Dooor at plane1 Open
  
  function Active()
     {  
       animatedObj2. animation.Play(); 
    animatedObj1.animation.Play(anim1clip.name);
  yield WaitForSeconds (2);  //    time door is close
    animatedObj3.animation.Play(anim3clip.name); 
       yield WaitForSeconds (10); // time lift move
    animatedObj4.animation.Play(anim4clip.name); 
 
  
 } 


I'm not sure if is a good way but work!

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

6 People are following this question.

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

Related Questions

Putting animations variables and run? 1 Answer

Animation.Play(useVar) 0 Answers

Enable and disable one button from a Static Var? 1 Answer

Can the animation editor create local rotational data? 3 Answers

Adding animation clips via script 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