hey, how do i activate a function using a true/false variable from another script?
var Shoot : ArrowControl = gameObject.Find("Arrow").GetComponent(ArrowControl);
if(Shoot.fire == true)
Dec 27 '10 at 03:44 AM
Get the object the script is on.
From that object, get the component on it.
On the component (Probably the script), set it equal to false/true. You have it right, just you aren't actually getting it from the target gameobject, I had this problem as well before.
Dec 27 '10 at 04:07 AM
I think I should add. What I said above, about getting it from the actual gameobject. That's all you need to do. Sorry to reiterate, I just think it's best if you get that from my answer.
I believe you can't declare the object and components in the variable it self... That needs to be done in an update or other function
Mar 08 '12 at 12:16 AM
Mar 07 '12 at 01:57 PM
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
Once you sign in you will be able to subscribe for any updates here
Answers and Comments
The best place to ask and answer questions about development with Unity. Check out our FAQ for more information.
To help users post good questions and use the site effectively we have posted a tutorial video. Please check it out.
asked: Dec 27 '10 at 03:44 AM
Seen: 1545 times
Last Updated: Mar 08 '12 at 12:16 AM
Access a static var from different named scripts?
Acsessing a script in the project folder
Function variable problem.
running code outside of update!
list of pre defined functions like Update and OnTriggerEnter to use
Resticing variables to whole numbers
Moving an enemy towards the player and taking him back to his original position is not working
On Button press Move Value toward
Inverse function of OnTriggerStay?