EV Destroy Failed. Could not find PhotonView Error..... Please Help.

Options

Hello,

i am building a networked tower defense game. The enemys, which occur are PhotonNetwork.Instantiated GameObjects. The enemys on my field belongs to my opponent. enemys on his field belongs to me. His towers shoots my enemys and when health is 0 the enemy gets destroyed via PhotonNetwork.Destroy(gameObject)


It works well. But sometimes, when a lot of tower are on the field and lot of enemys, suddenly the error

"EV Destroy Failed. Could not find PhotonView with InstantiationID. Sent by actorNr:2"

occurs....

i always check if photonView.IsMine....and destroy it. It seems unity trys to delete the gameObject twice or so... Here is my very easy wrote script. Pls help me.


MY BULLET SCRIPT:


  public void DamageStandard(Transform _enemy)

  {

    if (_enemy != null)

    {

      Enemy enemy = _enemy.GetComponent<Enemy>();

      enemy.GetDamage(damage);

    }

    else return;

  }



MY ENEMY SCRIPT:


  public void GetDamage(int damageAmount)

  {

    health -= damageAmount;

    if (health <= 0)

    {       

        Death();

    }

  }

  public void Death()

  {

    if (PV.IsMine)

    {

      PhotonNetwork.Destroy(gameObject);

    }    

  }

Comments

  • Solved the problem myself. Thanks for reading.

    made the GetDamage() to RPC and called it from bullet.

    Now the error doesnt occur anymore. Why it occured before, i dont know ^^.