- Home /
How can I make hitboxes visible to the player?
I want to make hitboxes visible to the player like you can do in minecraft by pressing f3+B. I really have no idea how I would do this so any help would be appreciated.
Answer by eskivor · Nov 19, 2021 at 05:30 PM
Add a 3d mesh on your object of the same shape as its hitbox, create a wireframe shader and apply to this object, then toggle the activation of the object depending the way you want to show and hide it.
Answer by CodesCove · Nov 19, 2021 at 05:38 PM
Colliders (or hitboxes as you call them) are not objects that are rendered in any way (other than in editor Scene view as Gizmos).
So in-game there is no direct way to make colliders visible. You need to make some mesh objects (like 3d cube) that aligns with the colliders geometry and assign material to the renderer that shows only edges or similar. Simplest way is actually to set the standard materials shader mode to transparent and adjust the color alpha channel.
In normal game play you keep the mesh renderer disabled and when you want the "collider" to be shown you just enable the mesh renderer.