Please Help : Ev Destroy Failed. Could not find PhotonView with instantiationId 2100. Sent by actorN
Im currently facing an issue in my project, Destroying enemys and bullets! I tough this would be so simple, but im stuck with this error for weeks!
So my game consistis in a portal defense, where enemys are spawned as SceneObjects and go towards the portal, the problem is trying to destroy them as clients creates a lot of errors and lot of lag for the client, while the MasterClient faces no lag, but usualy sees frozen bullets and enemys!
Here's a demo of what happens! The PC is master client and the Android is an client!
Youtube Video Link!
A bunch of errors like this pop up
"Ev Destroy Failed. Could not find PhotonView with instantiationId 2100. Sent by actorNr: 2"
and more than one with the same instantiation ID
This is what the android side sees, a bunch of enemys and bullets "frozen"
This is the code used on the bullets:
void DesativarDestruir()
{
if (GetComponent().IsMine)
PhotonNetwork.Destroy(gameObject);
else
Destroy(this.gameObject);
}
private void OnTriggerEnter2D(Collider2D collision)
{
if (collision.gameObject.CompareTag("cima") || collision.gameObject.CompareTag("baixo") || collision.gameObject.CompareTag("direita") || collision.gameObject.CompareTag("esquerda"))
SpawnarWallhit();
if (collision.gameObject.CompareTag("boss") || collision.gameObject.CompareTag("miniboss"))
SpawnarWallhit();
if (collision.gameObject.CompareTag("virusPortal"))
{
if (isOnline)
{
if (!isFireBall)
{
DesativarDestruir();
}
}
}
}
void SpawnarWallhit()
{
if (!isFireBall)
{
Instantiate(WallHit, transform.position, Quaternion.Euler(0.0f, 0.0f, Random.Range(0.0f, 360.0f)));
if (isOnline)
{
if (!isFireBall)
DesativarDestruir();
}
else
{
Destroy(this.gameObject);
}
}
}
And this is on the Enemys:
void DesativarDestruir()
{
if (GetComponent().IsMine)
PhotonNetwork.Destroy(gameObject);
else
Destroy(this.gameObject);
}
private void OnTriggerEnter2D(Collider2D collision)
{
if (collision.gameObject.CompareTag("Bullet"))
{
GameObject p = Instantiate(particulaTiro, transform.position, Quaternion.identity);
Destroy(p, 0.8f);
TocarSomMorte();
if (isOnline)
{
ExitGames.Client.Photon.Hashtable PropriedadesPlayer = new ExitGames.Client.Photon.Hashtable();
Player player = collision.gameObject.GetComponent().Owner;
if (player != null)
{
PropriedadesPlayer.Add("kills", ((int)player.CustomProperties["kills"] + 1));
player.SetCustomProperties(PropriedadesPlayer);
}
DesativarDestruir();
}
else
{
HordasStats.qtdKills++;
Destroy(collision.gameObject);
Destroy(this.gameObject);
}
}
}
So my game consistis in a portal defense, where enemys are spawned as SceneObjects and go towards the portal, the problem is trying to destroy them as clients creates a lot of errors and lot of lag for the client, while the MasterClient faces no lag, but usualy sees frozen bullets and enemys!
Here's a demo of what happens! The PC is master client and the Android is an client!
Youtube Video Link!
A bunch of errors like this pop up
"Ev Destroy Failed. Could not find PhotonView with instantiationId 2100. Sent by actorNr: 2"
and more than one with the same instantiation ID
This is what the android side sees, a bunch of enemys and bullets "frozen"
This is the code used on the bullets:
void DesativarDestruir()
{
if (GetComponent().IsMine)
PhotonNetwork.Destroy(gameObject);
else
Destroy(this.gameObject);
}
private void OnTriggerEnter2D(Collider2D collision)
{
if (collision.gameObject.CompareTag("cima") || collision.gameObject.CompareTag("baixo") || collision.gameObject.CompareTag("direita") || collision.gameObject.CompareTag("esquerda"))
SpawnarWallhit();
if (collision.gameObject.CompareTag("boss") || collision.gameObject.CompareTag("miniboss"))
SpawnarWallhit();
if (collision.gameObject.CompareTag("virusPortal"))
{
if (isOnline)
{
if (!isFireBall)
{
DesativarDestruir();
}
}
}
}
void SpawnarWallhit()
{
if (!isFireBall)
{
Instantiate(WallHit, transform.position, Quaternion.Euler(0.0f, 0.0f, Random.Range(0.0f, 360.0f)));
if (isOnline)
{
if (!isFireBall)
DesativarDestruir();
}
else
{
Destroy(this.gameObject);
}
}
}
And this is on the Enemys:
void DesativarDestruir()
{
if (GetComponent().IsMine)
PhotonNetwork.Destroy(gameObject);
else
Destroy(this.gameObject);
}
private void OnTriggerEnter2D(Collider2D collision)
{
if (collision.gameObject.CompareTag("Bullet"))
{
GameObject p = Instantiate(particulaTiro, transform.position, Quaternion.identity);
Destroy(p, 0.8f);
TocarSomMorte();
if (isOnline)
{
ExitGames.Client.Photon.Hashtable PropriedadesPlayer = new ExitGames.Client.Photon.Hashtable();
Player player = collision.gameObject.GetComponent().Owner;
if (player != null)
{
PropriedadesPlayer.Add("kills", ((int)player.CustomProperties["kills"] + 1));
player.SetCustomProperties(PropriedadesPlayer);
}
DesativarDestruir();
}
else
{
HordasStats.qtdKills++;
Destroy(collision.gameObject);
Destroy(this.gameObject);
}
}
}
0
Comments
-
I faced the same problem many many times before, the solution that worked for me is reimporting pun into unity0