Hi, I'm not really much of a programmer (more Audio) but in order to get my FMOD events to work properly I need to get an int value "health" from a java-script "enemyAI" which is attached to the same object.
I'm aware I need to compile the enemyAI script first by putting it in the right place and I'm also aware I need to use GetComponent, which I have used before for a collision event.
Could anyone be very kind and write a little bit of example script showing me how to do this including any variables that need declared.
Answer by Mike 3
Jul 20, 2010 at 10:31 PM
You do it the same way as normal. The only difference is that the script you're accessing has to be in one of the special compilation folders (/Assets/Plugins or /Assets/Standard Assets are the normal ones)
Check the documentation here:
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users post good questions and use the site effectively we have posted a user guide.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
Answers and Comments
No one has followed this question yet.
Object reference not set to an instance of an object
Why do I have to call ToString() when fetching a String from another script?
Cannot get script component while the game object has a refered script
[JS] - GetComponents (No appropriate version)