Unity Ninja Unity 3D Forum
To have exclusive access to all downloads, recourses and links within this forum, a free registered account is required. Just a heads up Wink
Share
Go down
Member [Lv. 3]
Member [Lv. 3]
Posts : 15
Points : 1440
Rep : 1
Join date : 2014-10-03
View user profile

Strategy Camera to FPS Camera (C#)

on Fri Jul 31, 2015 3:48 pm
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);
}
}

}
Member [Lv. 2]
Member [Lv. 2]
Posts : 14
Points : 1287
Rep : 0
Join date : 2015-03-07
Age : 16
Location : Sri Lanka
View user profile

Re: Strategy Camera to FPS Camera (C#)

on Thu Aug 06, 2015 9:14 am
The Problem Is You Put 4 arguments to instantiate statement what did you mean by "0" variable
Member [Lv. 3]
Member [Lv. 3]
Posts : 15
Points : 1440
Rep : 1
Join date : 2014-10-03
View user profile

Re: Strategy Camera to FPS Camera (C#)

on Thu Aug 06, 2015 9:51 pm
Not sure, used a blimey converter. I will try removing that and get back to you.
Member [Lv. 3]
Member [Lv. 3]
Posts : 15
Points : 1440
Rep : 1
Join date : 2014-10-03
View user profile

Re: Strategy Camera to FPS Camera (C#)

on Fri Aug 07, 2015 1:25 am
After fixing things, an area to select my player prefab does NOT appear in the inspector. Any help?
Back to top
Permissions in this forum:
You cannot reply to topics in this forum