Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We’re making changes to the Unity Runtime Fee pricing policy that we announced on September 12th. Access our latest thread for more information!
    Dismiss Notice
  3. Dismiss Notice

Question Multiple Colliders on a GameObject that can be added or removed with animation.

Discussion in '2D' started by TheOfficialPaladyn, May 13, 2023.

  1. TheOfficialPaladyn

    TheOfficialPaladyn

    Joined:
    Mar 27, 2023
    Posts:
    1
    Hello everyone, I am making a fighting game and I am starting to mess around with hitboxes. I understand how to animate hitboxes alongside my sprite, but I want to be able to add or remove colliders with the animation. For example, for an attack I would like to spawn in a new hitbox collider and make it disappear after the move finishes executing. How can I do this?
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,058
    I think you can enable/disable colliders easily enough via animation. Not sure you could add/remove in animation unless you made some kind of artificial boolean proxy object that you checked and did the spawn/remove yourself.

    Or just enable/disable entire copied subtrees of your animated attack. Not sure what the usual process is, but that's where I would start looking.
     
    TheOfficialPaladyn likes this.