So I’m trying to get multiplayer in my game with Photon. But the player prefab that needs to be loaded wont load with the error: PhotonNetwork error: Could not Instantiate the prefab [YouTwo (UnityEngine.Transform)]. Please verify you have this gameobject in a Resources folder (and not in a subfolder)
So I put the prefab in a new folder I called Resources. And it still wont work. There is not sub-directories, and the Resources folder is in the root of the assets folder.
Any help is greatly appriciated. If you need some more info to help please just say so.
Photon can’t instantiate a prefab like Network.Instantiate does. Photon requires you to place your prefab in an Resources folder. When you call PhotonNetwork.Instantiate you have to pass the name of the prefab to the function. Like i said in the comment above. ToString won’t return the name.
If you have the prefab you bound to the “playerPrefab” variable in a Resources folder, just try this:
PhotonNetwork.Instantiate(playerPrefab.name, transform.position, Quaternion.identity, 0);
Here is a helpful video for if ever you get this error when your prefab is already in the Resources folder