UnityNinja Community
Would you like to react to this message? Create an account in a few clicks or log in to continue.

UnityNinja CommunityLog in

UnityNinja - Video Game Development Community, including Resources, Forums, Marketplace & More.


descriptionStrategy Camera to FPS Camera (C#) EmptyStrategy Camera to FPS Camera (C#)

more_horiz
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);
}
}

}

descriptionStrategy Camera to FPS Camera (C#) EmptyRe: Strategy Camera to FPS Camera (C#)

more_horiz
The Problem Is You Put 4 arguments to instantiate statement what did you mean by "0" variable

descriptionStrategy Camera to FPS Camera (C#) EmptyRe: Strategy Camera to FPS Camera (C#)

more_horiz
Not sure, used a blimey converter. I will try removing that and get back to you.

descriptionStrategy Camera to FPS Camera (C#) EmptyRe: Strategy Camera to FPS Camera (C#)

more_horiz
After fixing things, an area to select my player prefab does NOT appear in the inspector. Any help?

descriptionStrategy Camera to FPS Camera (C#) EmptyRe: Strategy Camera to FPS Camera (C#)

more_horiz
privacy_tip Permissions in this forum:
You cannot reply to topics in this forum
power_settings_newLogin to reply