One Noob Question To Rule Them All(solved)

Heheee…I used to be able to do this but after a week of not working and comic con I forgot some basics.

On one script I have a variable. Lets call this script: Script1.

How do I have a totally different and separate script change the variable in Script1?

Thanks in advance!

I would recommend starting here - http://www.youtube.com/watch?v=5-X-Ebh1kYA&feature=channel

Just work your through all the videos there’s like 27 of them I think. Pretty good series to help you get you going.

Thanks but, I just need to know the syntax to send and receive information between two scripts. Does the 27 videos focus on just this topic?

I’m used to scripting in Lingo.

I am trying to help you by giving you that link. If I just give you the code it wont help you much. Same reason teachers back in school made you do homework you were more likely to remember the answer then if they were to just give you it.

The series of tutorials on you tube will cover this topic your wondering plus many more. It will help get you off the ground and move you in the right direction. Another very helpful link you could check out is the scripting reference documentation.

Or even a quick search on the forums will bring up quite a bit of information on this subject.

Best of luck,
Weylin

Ok, but this topic was posted to answer one question. Only one. And it would contain the answer in this sole post for other users to see.

We’re not in school. Its not cheating.

i have a noob question…

where is void main() ?

i mean the start of the program?

i want to manipulate when my models will appear …
and the camera, and so on …

how to make a script to “rule them all” ?

You can’t want the answer very badly. If you had followed the advice given, instead of arguing over whether you should have the answer handed to you or not, you’d have it by now.

Ok, but it’s bad manners to post your question in someone else’s thread.

There isn’t one. Unity is based on a component model, not procedural. If you want to deal with actions which happen as your scene/level begins, then you need to write a behaviour, apply it to your object and then write an Awake() or Start() method in the behaviour. Check the documentation for a more detailed explanation on exactly when Awake() and Start() methods are called.

hey, thanks …

it would be nice if you can give me a link on how to create behaviors.

i have a hard time understanding the tutorial. i think it is the “organization” of the tutorials about scripting … i mean they are all useful, but where do i start?

on my case, i think i should start on behaviors … and then worry about putting those components later …

You declare it like so, making it an exposed variable.

var importantFloat : float

outside of any function. If your script is called Script1, and if you’re calling it from a script attached the same Game Object, you can just do

GetComponent(Script1).importantFloat;

This works for functions as well…like so…

GetComponent(Script1).SomeFunction(someArgument);

And come on guys, maybe a bit less harsh? I know you’re trying to help, but he probably is working on a project and might not want to go through 27 video tutorials. Sooner or later he’ll likely hit a large enough wall that will require him to do more tutorials, but this isn’t it.

ericq, i suggest you search for tornado twins’s video tutorials at youtube.
Another place where you can look for an orientations is buzz’s site:
http://www.3dbuzz.com/vbforum/sv_showvideo.php?v=3592

When you dont have anything to do there is lots of time to look at the doc’s and video’s, but when your working on five projects, work two jobs have a cat dog and a fish and five kids to take care of and not any free time then this is where you get help from people willing to help :smile: and not turn you away :shock:

You could use static vars

//script 1
static var myFloat : float;
//script 2
//example
   if(script1Name.myFloat<=10) {
     helpMyFellowGameCreator;
}

:smile:

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

–Eric

Alright, thank you guys SOO MUUCH!! And thank you Black Mantis!! You totally get me!