- Home /
Object has to be a prefab in the project view.
I am getting this error while using Network.Instantiate, but i don't understand it as the object IS a prefab.
Following is a code block with the line causing the error
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");
}
Oh and this error pops up when we use the Bundle Manager plugin from the asset store. Testing the full apk(without using bundles) gives no error whatsoever.
Has somebody faced any similar issue. Any help would be appreciated. THanks
Your answer
![](https://koobas.hobune.stream/wayback/20220612065423im_/https://answers.unity.com/themes/thub/images/avi.jpg)