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 Alanj2007 · Nov 23, 2013 at 04:18 AM · animationlegacy

Problem with new version (Unity > Animation)

Using Unity Pro

Okay so, I'm working on this

There is blink mechanics. If you blink, your sanity will reduce by 10. You can blink by click screen but you must wait for 10 seconds for next turn.

BlinkClick script

 #pragma strict
 
 var topLid : GameObject;
 var bottomLid : GameObject;
 
 var regenSanity : float = 10.0;
 
 private var canClick : boolean = true;
 var timer : float = 3.0;
 
 private var sanityScript : InsanityManager;
 
 function Start()
 {
     sanityScript = GameObject.Find("First Person Controller").GetComponent(InsanityManager);
     topLid = GameObject.Find("Upper_Eyes");
     bottomLid = GameObject.Find("Down_Eyes");
 }
 
 function Update()
 {
     if (canClick) 
     {
         if (Input.GetMouseButtonDown(0)) 
         {
             timer = 10.0;
             canClick = false;
             topLid.animation.Play("UpperLid");
             bottomLid.animation.Play("DownLid");
             sanityScript.currentSanity -= regenSanity;
         }
     } 
 
     else 
     {
         timer -= Time.deltaTime;
         if (timer <= 0) 
         {
             canClick = true;
         }
     }
 }

I have 2 GameObject, "Upper_Eyes" and "Down_Eyes". Each of them has animation called "UpperLid" and "DownLid" I attach this gameobject to the script(Inspector)

What the problem is the script is trying to access the animation but script don't find any animations on it. This is the error I got.

ERROR#1

The AnimationClip 'UpperLid' used by the Animation component 'Upper_Eyes' must be marked as Legacy. UnityEngine.Animation:Play(String) BlinkClick:Update() (at Assets/Scripts/SanityScripts/SanityScripts/BlinkClick.js:28)

ERROR#2

The animation state UpperLid could not be played because it couldn't be found! Please attach an animation clip with the name 'UpperLid' or call this function only for existing animations. UnityEngine.Animation:Play(String) BlinkClick:Update() (at Assets/Scripts/SanityScripts/SanityScripts/BlinkClick.js:28)

ERROR#3

The AnimationClip 'DownLid' used by the Animation component 'Down_Eyes' must be marked as Legacy. UnityEngine.Animation:Play(String) BlinkClick:Update() (at Assets/Scripts/SanityScripts/SanityScripts/BlinkClick.js:29)

ERROR#4

The animation state DownLid could not be played because it couldn't be found! Please attach an animation clip with the name 'DownLid' or call this function only for existing animations. UnityEngine.Animation:Play(String) BlinkClick:Update() (at Assets/Scripts/SanityScripts/SanityScripts/BlinkClick.js:29)

  • already attached the animation to it!*

I ALREADY ATTACHED IT

  • do know what I need to do. I need to set this animation to Legacy, but the problem is that there is no option of it!*

THERE IS NO LEGACY OPTION

If you guys need 2 more script that involved in this mechanics. Here it is

Dizzy script

 #pragma strict
 
 private var mBlur : MotionBlur;
 
 private var sanityScript : InsanityManager;
 
 function Start()
 {
     mBlur = GameObject.Find("Main Camera").GetComponent(MotionBlur);
     sanityScript = GameObject.Find("First Person Controller").GetComponent(InsanityManager);
     mBlur.enabled = false;
 }
 
 function Update()
 {
     if(sanityScript.currentSanity >= 20)
     {
         mBlur.enabled = true;
         mBlur.blurAmount = 0.2f;
     }
     
     if(sanityScript.currentSanity >= 40)
     {
         mBlur.enabled = true;
         mBlur.blurAmount = 0.4f;
     }
     
     if(sanityScript.currentSanity >= 60)
     {
         mBlur.enabled = true;
         mBlur.blurAmount = 0.6f;
     }
     
     if(sanityScript.currentSanity >= 80)
     {
         mBlur.enabled = true;
         mBlur.blurAmount = 0.85f;
     }
     
         if(sanityScript.currentSanity >= 90)
     {
         mBlur.enabled = true;
         mBlur.blurAmount = 0.99f;
     }
 }

InsanityManager

 #pragma strict
 
 var currentSanity : float = 20.0;
 var maxSanity : float = 100.0;
 var minSanity : float = 0.0;
 
 var barLength = 0.0;
 
 function Start()
 {
     barLength = Screen.width / 8;
 }
 
 function Update()
 {
     if(currentSanity <= 100)
     {
         currentSanity -= Time.deltaTime;
     }
     
     if(currentSanity >= 100)
     {
         currentSanity = maxSanity;
     }
     
     if(currentSanity <= 0)
     {
         currentSanity = minSanity;
     }
 }
 
 function OnGUI()
 {
     GUI.Box(new Rect(5, 70, 70, 20), "Sanity");
     GUI.Box(Rect(70, 70, barLength, 20), currentSanity.ToString("0") + "/" + maxSanity);
 }
Comment
Add comment · Show 1
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 TheHoongs · Jan 04, 2014 at 12:36 PM 0
Share

...not me

0 Replies

· Add your reply
  • Sort: 

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

17 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

Related Questions

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

How do you set up a trigger animation without going through the collider? 0 Answers

Legacy Animation Advice 0 Answers

Unassigned Reference Exception 4 Answers

Animation by Scripting point A to B 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