Is it possible in Destroy() to indicate which object is to be removed?



  • Hi, how do you tell Destroy what object to remove? For example: I have three objects, in conflict with the first one, I need to remove the third, in a collision with the third, we need to remove the second. Thank you.



  • for example OnTriggerEnter, he's got an input parameter. OnTriggerEnter(Collider other) Then you can work with the other variables and check on what kind of activity the trigger has worked.

    void OnTriggerEnter(Collider other){
        if(other.CompareTag("Player")){
            Тут код который срабатывает при условии что в триггер попал обьект с тегом Player
        }
    }
    

    I tried to describe you as a primitive example of work logic. You're probably going to have to get a turkey tag, and you're gonna have to figure out what's going to happen if you have a cult 1, a rim 2, etc.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2