- Home /
View ID AllocatedID: X not found during lookup.
After two calls RPC, when run script CreepDie (), appear 2 errors .
1) View ID AllocatedID: 3 not found during lookup. Strange behaviour may occur
2) Could't invoke RPC function 'SetDamage' because the networkView 'AllocatedID: 3' doesn't exist
void OnCollisionEnter (Collision collision)
{
if(collision.collider.gameObject.tag == "AI")
{
NetworkView NetworkViewCreep = collision.collider.gameObject.networkView;
NetworkView nView;
nView = collision.collider.gameObject.GetComponent<NetworkView>();
Debug.Log("Collide GameObject "+nView.viewID);
if(Network.isServer)
NetworkViewCreep.RPC("SetDamage",RPCMode.All,10);
}
}
[RPC]
public void SetDamage(int Damage)
{
Debug.Log("Set Damage "+ Damage);
if(Damage<20)
{
HP -= Damage;
Debug.Log("Hp "+HP);
}
else
{
Debug.Log("Creep Die");
CreepDie();
}
}
[RPC]
public void CreepDie()
{
if(this.gameObject.transform.parent.gameObject!=null && Network.isServer)
{
Network.RemoveRPCs(this.gameObject.transform.parent.gameObject.networkView.viewID);
Network.Destroy(this.gameObject.transform.parent.gameObject);
}
}
Did you make sure you are adding the right scene in the build settings? I had similar issue.
Debug.log
1) AI AllocatedID: 2 - Build AI
2) Tower Weapon AllocatedID: 4 - Tower Fire
3) Collide GameObject AllocatedID: 3 - Tower Weapon Collide AI Child Object (AI AllocatedID: 2 - Empty Gameobject, It contains Creep $$anonymous$$ain Gameobject (AllocatedID: 3) , both have NetworkView)
4) Set Damage 100 - Creep got hit
5) Creep Die - After creep to die
On the Server - Creep Die On the Client - View ID AllocatedID: 3 not found during lookup.
Answer by Telmix · Nov 20, 2013 at 09:52 PM
Solved the problem of the so
[RPC]
public void CreepDie()
{
if(this.gameObject.transform.parent.gameObject!=null)
{
if(Network.isServer)
Network.RemoveRPCs(this.gameObject.transform.parent.gameObject.networkView.viewID);
Destroy(this.gameObject.transform.parent.gameObject);
}
}