Quantcast
Channel: Game Artist Forums
Viewing all articles
Browse latest Browse all 1037

Unity3d Javascript Scripting Question/Help

$
0
0
(i already tried asking in the unity3d forums as well but thought might as well ask here if someone can help me a bit)

need help with some script

good news is when i play it no errors and kind of got the logic how the script works

bad news what i want it to do is now working

long story short trying 2 simple things out

1. for GUIText whatever stored value on a variable i have on the player script etc should display on the GUI text

example in the player game object placed a script and declared a variable called "speed" with a value of 25...

that i want to show in the GUI Text

from what i understand in order to get value from a variable from another script i should use the gameObject.component

but i kinda of works if its a component of a game object...

but what if i am trying to access a value from a variable from another script?

anyways made two scripts one for the player

var speed : int ; function Start () { } function Update () { speed = - Pastebin.com

and one for the GUI

#pragma strict var DisplayStat : GUIText ; var script : Box ; function Start - Pastebin.com


2. this next set of script...basically trying out raycasting to check distance between to objects

basically what i wanted to simply happen if player is close enough to a certain object a debug.log ("your too close") will appear...


var Boxtest : GameObject; function Update() { var fwd = transform - Pastebin.com




the good news is when i hit play no errors BUT the things i want to happen...cant seem to get it working hmmm

Viewing all articles
Browse latest Browse all 1037

Trending Articles