x


How do i call on variables from other scripts?

Just like the question states, I need to call on variables from multiple scripts.

The context being used here is an Options menu. The menu will provide sliders for various adjustments to the game mechanics (Player speed, Lighting effects, etc.) But i need to know how to call on a variable in another script. For example. I'd like to set a slider that would call on the player's speed variable in my FPS Controller script, but I'd like to set my GUI menu up in one single separate script attached to a hot-key (probably "O")

I don't really know how to explain it better than that, hopefully someone can give me insight on calling variables from other scripts.

more ▼

asked Apr 25 '10 at 04:27 AM

CalledToGaming gravatar image

CalledToGaming
190 21 24 30

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

2 answers: sort voted first

This is covered in the docs about accessing other game objects.

more ▼

answered Apr 25 '10 at 04:48 AM

Eric5h5 gravatar image

Eric5h5
102k 49 165 620

Thanks, I'll look over it. Man, you're always there first to answer my questions. Sir, you rock!

Apr 25 '10 at 04:52 AM CalledToGaming
(comments are locked)
10|3000 characters needed characters left

Very similar questions have also been asked and answered in detail many times before, so make sure you try searching the site too, before posting a question!

(although the search feature on this site isn't great - it's often better to google, like this custom unity search -, so apologies if you already did).

more ▼

answered Apr 25 '10 at 06:08 AM

duck gravatar image

duck ♦♦
45.7k 109 164 426

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

x7777
x5089
x4376
x1212
x22

asked: Apr 25 '10 at 04:27 AM

Seen: 7005 times

Last Updated: Apr 25 '10 at 04:27 AM