- Home /
Prefab error while using Network.Instantiate
Using unity 4.7.
I am using the Bundle Manager plugin(https://www.assetstore.unity3d.com/en/#!/content/14035) from the asset store to bundle my scenes for a game that i am building. I am facing an error with Network.Intantiate. Following is the code block
if (PlayerPrefs.GetString("serverType" == "MobileGlobal" ? Network.isClient : true)
{
var playerNumber : int;
var spawnPos : Transform;
var myNewTrans : Transform;
// if (Network.isClient) {
playerNumber = parseInt(Network.player+"";
spawnPos = spawnPositons[playerNumber - (PlayerPrefs.GetString("serverType" == "MobileGlobal" ? 1 : 0)];
var carToSpawn : Transform = playerPrefabs[PlayerPrefs.GetInt("ChangeModel"];
Debug.Log("Spawning car: " + carToSpawn);
myNewTrans = Network.Instantiate(carToSpawn, spawnPos.position, spawnPos.rotation, 0);
Debug.Log("Debug 1";
myNewTrans.SendMessage("SetMissileDisplay", missileDisplay);
Debug.Log("Debug 2";
camFollow.target = myNewTrans;
Debug.Log("Debug 3";
mapCam.SendMessage("SetTarget", myNewTrans);
Debug.Log("Debug 4";
}
Here, while running it with the android debugger i get an error saying the object has to be a prefab in the project view. I don't understand this because the object IS a prefab... Also i should mention that this error only shows while trying to bundle it and only with Network.Instantiate(trying a multiplayer mode). The normal Instantiate(Single player) works just fine and also that this error is only with the asset bundling. The full apk works perfectly fine.
Any help would be appreciated greatly. Thanks in advance.
Your answer
Follow this Question
Related Questions
Object has to be a prefab in the project view. 0 Answers
Download remote files to use at runtime 1 Answer
How to import the object from server to unity 2 Answers
How can assign just 1 specific prefab to 1 specific player?(Multiplayer) 0 Answers
How to manipulate a variable of a prefab script (instantiated) while the game is runnning . 1 Answer