- Home /
Question by
janeshvarmishra · Dec 11, 2015 at 01:51 PM ·
2dmultiplayerobjectphotonspawn
Is possible to spawn 2d image in photon networking ?
hi..
Is is possible to instantiate 2d image in network ? I can succesfully spawn 3d cube in network. But when I am making 2d image prefab and following same steps like 3d object spawning in network, it spawing succussfully but does not displaying in network.
How to spawn image that displays in network ? i.e two different apps.
when using cube - it is displaying in network app. Spawned 2d object does not seems in window.
This is the code below that i am using for spawing 2d player in photon network.
using UnityEngine; using System.Collections; using UnityEngine.UI;
public class NetworkManager : MonoBehaviour {
[SerializeField] Text connectiontext;
//[SerializeField] RectTransform[] Spanpoints = new RectTransform[6];
[SerializeField] Transform[] Spanpoints;
[SerializeField] public GameObject Panelcanvas;
GameObject player;
// Use this for initialization
void Start ()
{
PhotonNetwork.logLevel = PhotonLogLevel.Full;
PhotonNetwork.ConnectUsingSettings ("0.1");
}
// Update is called once per frame
void Update ()
{
connectiontext.text = PhotonNetwork.connectionStateDetailed.ToString ();
}
void OnJoinedLobby()
{
RoomOptions ro = new RoomOptions () { isVisible = true , maxPlayers = 10};
PhotonNetwork.JoinOrCreateRoom ("default", ro, TypedLobby.Default);
}
void OnJoinedRoom()
{
//Debug.Log("dokjhkhhkne");
StartCoroutine(SpawnPlayer(0f));
}
//[PunRPC]
void StartSpawnProcess (float respawntime)
{
StartCoroutine ("SpawnPlayer", respawntime);
}
IEnumerator SpawnPlayer (float respawntime)
{
yield return new WaitForSeconds (respawntime);
// int rand = Random.Range (0,6);
int index = Random.Range (0, Spanpoints.Length);
player = PhotonNetwork.Instantiate ("Cube", Spanpoints [index].position,Spanpoints[index].rotation,0);
//Debug.Log (index);
// player.transform.SetParent (Panelcanvas.transform);
Debug.Log("done");
}
}
Comment