Instantiate an object in network, using following code but it is not working
Options
Srinivas
✭
I Used Code Below, object instantiate normally but not with network. I attach photonview with prefab and prefab is in Resources folder. how to overcome this please someone help me. Thank you in advance
using System.Collections; using System.Collections.Generic; using UnityEngine; public class _Manager : Photon.MonoBehaviour { public GameObject PlayerPrefab; private void Start(){ SpawnInNetwork (); } public void SpawnInNetwork(){ PhotonNetwork.Instantiate ("PlayerPrefab", Vector3.zero, Quaternion.identity, 0); // GameObject temp = Instantiate(PlayerPrefab) as GameObject; // temp.transform.position = new Vector3 (0, 0, 0); // Debug.Log ("Spawned dflaksjdf kdfja djflk flkdsjf ajflsd fskalf sakdf saflsjdlfj"); } }
0
Best Answer
-
Your code should be
PhotonNetwork.Instantiate (PlayerPrefab.name, Vector3.zero, Quaternion.identity, 0);
5
Answers
-
Your code should be
PhotonNetwork.Instantiate (PlayerPrefab.name, Vector3.zero, Quaternion.identity, 0);
5 -
thank you0