Skip to main content

Posts

Showing posts with the label reference

Referencing another script..

So, here's how it's done. function addingExp(){     var level = gameObject.Find("Player").GetComponent(Level);     level.experience +=50; } Explanation: gameObject.Find("Player")  Finds the object the script it attached to. Player is the name of the object, note that the name has to be in quotations. GetComponent(Level) Finds the name of the script. level.experience +=50; level is calling the variable that we just set above, experience is a variable within the script that were calling on in the code.

First Blog...

Well, its going to be about creating games on Unity . I am relatively new to the interface and JavaScript. But I have gotten used to it through great tutorials and scripting references . I am going to be developing a simple (or at least at first.) video game, and keeping track of it on this blog here. Unless your at least relatively familial with Unity, you might want to watch all the tutorials (Yes I know its alot) to understand exactly what I am talking about.