FragMate CommunityLog in

FragMate - Software and Game Developer Community, including Resources, Forums, Marketplace & More.

Share

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

}

descriptionRe: 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

_________________
Embarassed Sewmina

descriptionRe: Strategy Camera to FPS Camera (C#)

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

descriptionRe: 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?
Permissions in this forum:
You cannot reply to topics in this forum