how do i make a prefab robot that explodes when you near it?

i’ve only just started using unity recently and am wondering if there is a way to make a new robot in that FPS microgame i chose. i have copied files and rigs from that hovering bot, and have edited it to change what it looks like, but at the moment its still just shooting like a hoverbot. does anyone know how i can edit the prefab so it self destructs, when neared, dealing damage.

Hi, your questions are quite specific. You can break it into trigger and effect.

Trigger:

  • How to do something when one object gets closer to another? (learn about trigger colliders)

Effect:

  • How to destroy objects (learn about object.Destroy)
  • (maybe) how to create explosion effect
  • How to deal damage

You can search for each of these topic separately and then combine the things you learn into the specific thing you need.