- Home /
Need help on Transportation errors
Im trying to setup a tranportation script... basically when a player gets near a boat or something like that it shows this GUI and once they hit the button it transports them to the designated positions which are variables... Im using a C# script and this is it
using UnityEngine; using System.Collections;
public class Transportation : MonoBehaviour { public string Message; public int ScreenWidth; public int ScreenHeight;
public int TeleX;
public int TeleY;
public int TeleZ;
private Vector3 TransportTo;
void OnGUI() {
Transport();
}
private void Transport() {
if(GUI.Box(new Rect((ScreenWidth - 10), (ScreenHeight - 10), 150, 75), "") {
TransportTo = new Vector3(TeleX, TeleY, TeleZ)
}
GUI.Label(new Rect(ScreenWidth, ScreenHeight, 100, 20), Message);
GUI.Button(new Rect((ScreenWidth + 27), (ScreenHeight + 25), 100, 20), "Go!");
}
}
This is the error i get
Assets/My Assets/Scripts/Transportation.cs(21,92): error CS1525: Unexpected symbol `{'
Its hard for me to explain because i know what the error means but i dont know how to fix them... sorry...
Its most likely some simple thing that i am missing but if it is than please point it out and tell me how to fix...
Answer by · Oct 25, 2010 at 02:58 AM
Your line:
TransportTo = new Vector3(TeleX, TeleY, TeleZ)
is missing a semicolon. Should be:
TransportTo = new Vector3(TeleX, TeleY, TeleZ);
thanks that did that trick... im kind of upset i missed that about 100 times before i posted this question...
No worries, it happens to the best of us! :D Please mark this one as solved so it's not bumped back to the top of the list as an 'Unanswered question'. Cheers!
Your answer
