- Home /
Question by
rick-grendel · Nov 28, 2014 at 09:26 PM ·
javascriptdrawline
What is wrong with this script?
Ok, I am working on this for hours but it wont work its a script to create A debugline between to objects on a advanced way (So far). But its not working... No errors.
This is my script:
class RayColors extends System.Object {
var geel : boolean = false;
var groen: boolean = false;
var rood: boolean = false;
var blauw : boolean = false;
}
class Rays extends System.Object {
var SWP : Transform;
var Activate : boolean = false;
var RayColors = RayColors ();
}
var rays : Rays[];
var player : Transform;
var first : boolean = false;
function Start () {
}
function Update () {
if(rays[0].Activate == true)
{
if(rays[0].RayColors.geel == true)
{
Debug.DrawLine(transform.position, rays[0].SWP.transform.position, Color.yellow);
if(rays[0].RayColors.groen || rays[0].RayColors.rood || rays[0].RayColors.blauw)
{
Debug.LogError("Make sure 1 color is activated!");
}
}
}
}
Comment
var Activate : boolean = false;
Do you change this to true in rays[0]?
Answer by Vetpetmon · Nov 28, 2014 at 10:07 PM
try this:
#pragma strict
class RayColors extends System.Object {
var geel : boolean = false;
var groen: boolean = false;
var rood: boolean = false;
var blauw : boolean = false;
}
class Rays extends System.Object {
var SWP : Transform;
var Activate : boolean = false;
var RayColors = RayColors ();
}
var rays : Rays[];
var player : Transform;
var first : boolean = false;
function Start () {
}
function Update () {
if(rays[0].Activate == true)
{
if(rays[0].RayColors.geel == true)
{
Debug.DrawLine(transform.position, rays[0].SWP.transform.position, Color.Yellow);
if(rays[0].RayColors.groen || rays[0].RayColors.rood || rays[0].RayColors.blauw);
{
Debug.LogError("Make sure 1 color is activated!");
}
}
}
}
Answer by YoungDeveloper · Nov 28, 2014 at 10:09 PM
When posting question, post the error too.
It's Color.yellow not Color.Yellow
Be sure you defined Rays array size from inspector, at least in length of 1
I sad in the question description that there is no error.
yes sorry but not the solution.
i dont get that?