x


Get.Component from C# to Java

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.

Thanks!

more ▼

asked Jul 20, 2010 at 10:26 PM

Graeme gravatar image

Graeme
53 25 19 26

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

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:

http://unity3d.com/support/documentation/ScriptReference/index.Script_compilation_28Advanced29.html

more ▼

answered Jul 20, 2010 at 10:31 PM

Mike 3 gravatar image

Mike 3
33k 21 84 292

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

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

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x6277
x745

asked: Jul 20, 2010 at 10:26 PM

Seen: 3206 times

Last Updated: Jul 20, 2010 at 10:26 PM