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 Alecmac · May 01, 2015 at 01:20 AM · animationjavascript

Interactive Advert, Animation Problems

I am trying to create an interactive advert in Unity 3.5 with 3 characters, each with an entrance, waiting, question answer and exit animation. There is also buttons on the camera that when pressed trigger an answer animation. The idea is that the characters walk in, wait and after a timer has gone, exit. If a question is asked within the waiting time, then it plays. Once it has played, the waiting animations and timer reset.

However, when I play the scene this message comes up. "MissingComponentException: There is no 'Animation' attached to the "Camera" game object, but a script is trying to access it. You probably need to add a Animation to the game object "Camera". Or your script needs to check if the component is attached before using it. UnityEngine.Animation.Play (System.String animation) Text.OnGUI () (at Assets/Text.js:23)"

This message is on the console and is repeated when I press either of the buttons, along with my characters not moving at all.

Here is the UnityScript/JavaScript code that I am using and making.

// JavaScript var myTimer : float = 10;

function OnGUI () { //Text box GUI.Label ( new Rect (370, 500, 400, 30), "Ask A Question From The List Below");

 //Question 1 with box and response animation
     if (GUI.Button (Rect (300, 550, 100, 30), "Who Are You?")) {
     // This code is executed when the Button is clicked
     animation.Play("Lord@InkAnswer1");
      }
          
              //Question 2 with box and response animation
           if (GUI.Button (Rect (500, 550, 150,30), "Why Are You Here?")) {
         // This code is executed when the Button is clicked
             animation.Play("Lord@InkAnswer2");
         animation.Play("Scrib@ScribbleAnswer2");
         animation.Play("Splat@SplatterAnswer2");
      }
                  //Starting animations
         animation.Play("scrib@scribbleidle");
         animation.Play("Lord@Inkidle");
         animation.Play("scrib@splatteridle");
         
             //Waiting animations
                  animation.Play("scrib@scribblewaiting");
                  animation.Play("lord@Inkwaiting");
                  animation.Play("scrib@splatterwaiting");
                      
                          //timer for waiting animations
                      if (myTimer > 0) {
                              myTimer -= Time.deltaTime;
                              }
                                  //when the timer ends, this animation plays
                                  if (myTimer <=0) {
                                  animation.Play("scrib@scribbleexit");
                                  animation.Play("scrib@splatterexit");
                                  animation.Play("Lord@Inkexit");
                              }
                  

}

I need the animations to play but I need the buttons to be shown and be interactive when it plays. This is the only script I am using and is attached to the camera at the moment because of the buttons.

I am struggling to figure it out and need immediate help!

Please help me.

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

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

2 People are following this question.

avatar image avatar image

Related Questions

Attack While Running 1 Answer

How do i apply animations in javascript? 0 Answers

How to control speed of animation on Unity by a .txt file? 1 Answer

Animation doesn't work 1 Answer

Referencing data in pre-defined array 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