# Photon-Unity Instantiation not working

I use Unity and Photon for the multiplayer. I Instantiate my gameObjects using this method :

void LoadGameObject(PhotonPlayer player,bool isMaster)
{
if (isMaster)
{
GameObject baby = PhotonNetwork.InstantiateSceneObject(babies[0].name,
babies[0].transform.position, Quaternion.identity, 0,null);
baby.SetActive(true);
Debug.Log("playerpref created on " + player.ID);
}
else
{
//Nothing for the moment
}
}


I call the method in "OnJoinedRoom()" and "OnPhotonPlayerConnected(PhotonPlayer other)", but when the second player join the room, he can't see the gameObjects because they aren't activated on his scene.

Any Idea of the mistake ?

• It looks like you've got your prefab deactivated initially, requiring an explicit call to SetActive(true) to activate it. But I don't see where you call SetActive on the non-master instances — can you show us this? – DMGregory Mar 5 '19 at 18:17
• Thanks for your help, it was right. I just activated my GameObjects before instantiation because I didn't need to keept it inactive, and now it works fine. – GameDevF7 Mar 6 '19 at 10:37
• Great! If you've solved your problem, be sure to post your solution as an Answer below. – DMGregory Mar 6 '19 at 11:55