Quantcast
Channel: Latest Questions on Unity Answers
Viewing all articles
Browse latest Browse all 171066

Global var not communicating with script

$
0
0
Hello again, I have a problem with one of my variables this time. I have a script (1st) that has a bol called "clicked" which another script (2nd) is suppose to receive. The problem is... it wont. I have set a debug to print when it finds the variable has been labeled as true, but to no avail. I thought all open variables in javascipt are public? Please help however you can. var pressed : boolean = false; var clicked : boolean = false; var Start : GameObject; var Settings : GameObject; var Speedtap : GameObject; var Endurance : GameObject; var Timed : GameObject; //var BackM : GameObject; var Back : GameObject; var Memory : GameObject; function OnMouseDown () { audio.Play(); if (pressed == true) { Start.active = true; Speedtap.active = false; Endurance.active = false; Timed.active = false; Memory.active = false; Back.active = false; //BackM.active = true; clicked = true; } } function OnMouseUp () { pressed = true; renderer.material.color = Color.red; audio.Play(); } _________________________________________________ var clicked : boolean = false; function Update () { if (clicked == true) { animation.Play(); Debug.Log("Recieved"); } }

Viewing all articles
Browse latest Browse all 171066

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>