x


Reference C sharp script from Javascript

ok, so I have a javascript set up to create an inventory system. what I want to do, is include a player stats menu with it. (I'm just gonna have health for now, I don't actually have any other stats set up yet.)

now, for my health script, I used C#. I want to know if there is an easy way to referance this script in my inventory script. is that possible? because what I first used was this bit in the start function

HP_Script = GetComponent(PlayerHealth);

and then I had a series of variable referencing HP_Script to set up the GUI. but it gave me an error saying that it couldn't find PlayerHealth. I tried going into the inspector and adding the script to the HP_Script target manually, but it doesn't let me.

any help would be greatly appriciated

more ▼

asked Jul 24 '11 at 05:17 PM

Dbag gravatar image

Dbag
11 3 3 4

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

1 answer: sort newest

http://unity3d.com/support/documentation/ScriptReference/index.Script_compilation_28Advanced29.html , though it would be better if you just used Javascript for your health script; mixing languages in this case is needlessly complicating things.

more ▼

answered Jul 24 '11 at 06:06 PM

Eric5h5 gravatar image

Eric5h5
81.5k 42 133 529

(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:

x4374
x3570
x276

asked: Jul 24 '11 at 05:17 PM

Seen: 1800 times

Last Updated: Jul 24 '11 at 06:10 PM