So im working on a single player MMORPG (yes i know mmorpg stands for massively multiplayer online.....etc) im just not experienced in making anything multiplayer yet.
Back on topic im getting this error
"Assets/My Assets/scripts/closest.js(43,61): BCE0044: expecting :, found '='."
with this code
//debug text
var tree : String;
//Menu Settings
var MenuActive1:boolean = false;
var timer : float = 5;
//Find closest Tree/Click on tree?
function Update () {
//Finding Closest Tree
var waypoints: GameObject[] = GameObject.FindGameObjectsWithTag("ClickAble");
var closest: GameObject;
var closestDist = Mathf.Infinity;
for (waypoint in waypoints) {
var dist = (transform.position - waypoint.transform.position).sqrMagnitude;
tree = waypoint.name;
print(Object);
print(dist);
if (dist < closestDist) {
closestDist = dist;
closest = waypoint;
}
}
//LookAt Closest
//transform.LookAt(closest.transform);
///////////////////////////////////////
//Click Code
if (Input.GetMouseButton(0)) {
var ray: Ray = Camera.main.ScreenPointToRay(Input.mousePosition);
var hit: RaycastHit;
var playerDist = transform.position;
var distance = dist;
var obHit = hit.transform;
if(distance < 8 && timer == 5 ){
timer = 0;
if (Physics.Raycast(ray, hit)) {
switch ( obHit.name ){
case HTree001:
{
MenuActive1 = true;
print(hit.transform.name);
}
case HTree002:
{
MenuActive1 = true;
print(hit.transform.name);
}
}
}
}
else {timer += 1;}
}
}
function OnGUI () {
if (MenuActive1 == true)
{
if (MenuActive1 == true){
// Make a background box
GUI.Box (Rect ((Screen.width-31)/2,190,220,180), "Large Tree
.
.");
//Second button returns to main menu
if (GUI.Button (Rect((Screen.width-31+200)/2,285,80,20), "Accept")) {
MenuActive1=!MenuActive1;
}
//Second button returns to main menu
if (GUI.Button (Rect((Screen.width-31+200)/2,320,80,20), "Cancel")) {
//Closes the menu
MenuActive1=!MenuActive1;
}
}
}
}
With this line
MenuActive1 = true;
EDIT* i added the semicolons to the print features and it is still giving me the same error.
Did you read everything I wrote? What about the missing end bracket?
– anon19273036You are definitely missing a bracket. I just checked it in unitron. Move your cursor around the bracket that is meant to close the update function and you'll see it is actually closing "if (Input.GetMouseButton(0)) {". Set up your indents and you'll see it
– anon19273036