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 ben · Dec 28, 2010 at 10:55 AM · animationgui

made animation in idle state while click back

problem with the following ..... in a single scene i have some cameras... i can move between cameras by using next button.. each sub scenes having some animations , it will work by click....after finishing my animation move to next sub scene... if i will come back to the previous scene using back button the animations should be ideal...tell me the logic....also once you finished all animation then only next button should enable.... help me with the script

//camera var cam1 : Camera; var cam2 : Camera; var cam3 : Camera; var cam4 : Camera; var cam5 : Camera;

//buttons var infeed1 : Transform; var infeed2 : Transform; var infeed3 : Transform; var infeed4 : Transform;

var outfeed1 : Transform; var outfeed2 : Transform; var outfeed3 : Transform;

var powerswitch : Transform;

//GUI var cus : GUISkin;

//Textures var hmi1 : Texture; var hmi2 : Texture; var hmi3 : Texture; var hmi4 : Texture; var hmi5 : Texture; var hmi6 : Texture; var hmi7 : Texture; var hmi8 : Texture; var hmi9 : Texture;

//Animations var infeed : Animation; var outfeed : Animation; var power1 : Animation;

//variables var a1 = 0; //var a2 = 0;

function Start() {

cam1.enabled = true; cam2.enabled = false; cam3.enabled = false; cam4.enabled = false; cam5.enabled = false;

}

function OnGUI() { if(cam1.camera.enabled == true) { if(a1 == 0) {

GUI.skin = cus; GUI.Box(Rect(0,0,Screen.width,60), "Welcome to WeilerLable Lab \n Lets start by turning on the accumulation tables");

 if(GUI.Button(Rect(Screen.width * 0.9 , 15,100,30), "NEXT"))
 {
     cam1.enabled = false;
     cam2.enabled = true;

     a1++;
  }

}

}

if(cam2.camera.enabled == true) {

 GUI.skin = cus;
 GUI.Box(Rect(0,0,Screen.width,60), "This is the INFEED ACCUMULATION TABLE \n Turn each and every knob to the START positon ");

if(a1 == 1) {

     if(GUI.Button(Rect(Screen.width * 0.9 , 15,100,30), "NEXT"))
     {
         cam2.enabled = false;
         cam3.enabled = true;

         a1++;
     }

 }        
     if(GUI.Button(Rect(Screen.width * 0.1/10000, 15 , 100, 30),"BACK"))
     {
         cam1.enabled = true;
         cam2.enabled = false;

         a1=1;
     }

// } }

if(cam3.camera.enabled == true) {

 GUI.skin = cus;
 GUI.Box(Rect(0,0,Screen.width,60), "This is the OUTFEED ACCUMULATION TABLE \n Turn each and every knob to the START positon ");

 if(a1 == 2)
  {
     if(GUI.Button(Rect(Screen.width * 0.9 , 15,100,30), "NEXT"))
     {
         cam3.enabled = false;
         cam4.enabled = true;

         a1++;
     }

  }       
     if(GUI.Button(Rect(Screen.width * 0.1/10000, 15 , 100, 30),"BACK"))
     {
         cam2.enabled = true;
         cam3.enabled = false;

         //a2++;
         a1=2;
     }
 // }

}

if(cam4.camera.enabled == true) {

 GUI.skin = cus;
 GUI.Box(Rect(0,0,Screen.width,60), "Turn ON the Main POWER Switch ");

   if(a1 == 3)
   {

     if(GUI.Button(Rect(Screen.width * 0.9 , 15,100,30), "NEXT"))
     {
         cam5.enabled = true;
         cam4.enabled = false;

         a1++;
     }
   }

     if(GUI.Button(Rect(Screen.width * 0.1/10000, 15 , 100, 30),"BACK"))
     {
         cam3.enabled = true;
         cam4.enabled = false;

         //a2++;
         a1=3;
     }

// }

}

}

function Update () { if(Input.GetMouseButtonDown(0)) { var ray = camera.ScreenPointToRay(Input.mousePosition); var hit : RaycastHit;

if(Physics.Raycast(ray,hit)) {

       if(cam2.camera.enabled == true && a1 == 1)
       { 
         if(hit.transform == infeed1)
         {
             infeed.Play("left");
             }

         if(hit.transform == infeed2)
         {
             infeed.Play("l2");
             }

         if(hit.transform == infeed3)
         {
             infeed.Play("l3");
             }

         if(hit.transform == infeed4)
         {
             infeed.Play("right");
             }   
       }     

     if(cam3.camera.enabled == true && a1 == 2)
     {           
         if(hit.transform == outfeed1)
         {
             outfeed.Play("left");
             }
     }       

         if(hit.transform == powerswitch)
         {
             power1.Play("play");
             }

 }

}

}

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 ben · Mar 08, 2011 at 11:05 AM 0
Share

once the scene get finished stop that particular animation using $$anonymous$$cher.Stop("Play"); once click back button play the idle animation

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

No one has followed this question yet.

Related Questions

Unity 5 GUI system 1 Answer

Activating UI panel on GameObject Click/Destroy 0 Answers

Control an animation with a slider 5 Answers

Object disappearing after playing animation. 6 Answers

HELP with scripting where GUI is involved 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