- Home /
Unable to network remove object
Hi, I am trying to delete an object on the network:
PhotonNetwork.Destroy(bullet.gameObject);
To instantiate this object I am doing this:
{
...
int newViewId= PhotonNetwork.AllocateViewID();
photonView.RPC("InstantiateProjectile", PhotonTargets.AllBuffered, newViewId, ... );
}
/// <summary>
/// Instantiate a projectile and add its behaviour
/// </summary>
[RPC]
public void InstantiateProjectile(int inViewId, ... )
{
// instantiate projectile
GameObject tempProjectile = Instantiate(projectileObject,
new Vector3(inTransformPosition.x + 0.2f, inTransformPosition.y, inTransformPosition.z),
Quaternion.Euler(angle)) as GameObject;
tempProjectile.GetComponent<ProjectileStats>().clickPos = target;
tempProjectile.GetComponent<ProjectileStats>().SetBulletDirection();
tempProjectile.GetComponent<PhotonView>().viewID = inViewId;
}
because I am not using photons instantiation I am getting the following error:
Failed to 'network-remove' GameObject because it is missing a valid InstantiationId on view: View (0)1016 on ProjectileArcher(Clone) . Not Destroying GameObject or PhotonViews!
Now how come I am getting this when I am assigning it a viewID?
Comment
Your answer
Follow this Question
Related Questions
Sync game objects across network Photon C# 1 Answer
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Photon Networking Spawn player 2 0 Answers
Photon synchronization 1 Answer