Alright, so i got this going for me, but I get this error, which argument am i missing?
I want my button "Play" To, on click, spawn my player, any help? Thanks!
Error:
Assets/Scripts/BuildingManager.cs(31,25): error CS1501: No overload for method `Instantiate' takes `4' arguments
Script:
void OnGUI() {
//Making a button background
GUI.Box (new Rect (0, 10, 300, 900), "Buildings");
for (int i = 0; i <buildings.Length; i ++) {
if (GUI.Button(new Rect(Screen.width/20,Screen.height/15 + Screen.height/12 * i,100,30), buildings[i].name)) {
buildingPlacement.SetItem(buildings[i]);
}
}
//Making a clickable button that allows the player to spawn himself
if (GUI.Button(new Rect(95,600,100,30), "Play")) {
Instantiate(playerPrefab, spawnObject.position, Quaternion.identity, 0);
}
}
}
I want my button "Play" To, on click, spawn my player, any help? Thanks!
Error:
Assets/Scripts/BuildingManager.cs(31,25): error CS1501: No overload for method `Instantiate' takes `4' arguments
Script:
void OnGUI() {
//Making a button background
GUI.Box (new Rect (0, 10, 300, 900), "Buildings");
for (int i = 0; i <buildings.Length; i ++) {
if (GUI.Button(new Rect(Screen.width/20,Screen.height/15 + Screen.height/12 * i,100,30), buildings[i].name)) {
buildingPlacement.SetItem(buildings[i]);
}
}
//Making a clickable button that allows the player to spawn himself
if (GUI.Button(new Rect(95,600,100,30), "Play")) {
Instantiate(playerPrefab, spawnObject.position, Quaternion.identity, 0);
}
}
}