Синтаксис:
Используется csharp
public GameObject newo;
PhotonView newo2;
public void inst()
{
newo = Resources.Load<GameObject>(it.prefab);
newo.transform.position = transform.position + transform.forward + transform.up;
newo2 = newo.GetPhotonView();
int id1 = PhotonNetwork.AllocateViewID();
newo2.RPC("InstantiateRpc2", PhotonTargets.AllBuffered, id1, newo.name);
}
[PunRPC]
void InstantiateRpc2(Vector3 pos, Quaternion rot, int id1, string np)
{
GameObject newo = Resources.Load<GameObject>(np);
Transform objg = Instantiate(newo, pos, rot) as Transform;
PhotonView[] nViews = objg.GetComponentsInChildren<PhotonView>();
nViews[0].viewID = id1;
}
PhotonView newo2;
public void inst()
{
newo = Resources.Load<GameObject>(it.prefab);
newo.transform.position = transform.position + transform.forward + transform.up;
newo2 = newo.GetPhotonView();
int id1 = PhotonNetwork.AllocateViewID();
newo2.RPC("InstantiateRpc2", PhotonTargets.AllBuffered, id1, newo.name);
}
[PunRPC]
void InstantiateRpc2(Vector3 pos, Quaternion rot, int id1, string np)
{
GameObject newo = Resources.Load<GameObject>(np);
Transform objg = Instantiate(newo, pos, rot) as Transform;
PhotonView[] nViews = objg.GetComponentsInChildren<PhotonView>();
nViews[0].viewID = id1;
}