Home > Software engineering >  How to create a a gameobjective that is only visible in scene view, not game
How to create a a gameobjective that is only visible in scene view, not game

Time:11-20

I would like to create a bunch of gameobjects to be used as spawn points and path finding targets, I’d like these to be visible on the scene view, even while the game is running, but not visible in the game. Seems like this should be a thing, but I’m failing to find it.

I’ve tried googling this, but all I find are people that are experiencing this behavior, but it undesired.

CodePudding user response:

If you just want to see them, you can use OnDrawGizmos.

Inside this MonoBehaviour function, you can use Gizmos.DrawSphere(position, radius) to draw a sphere that can only appear in scene view. You just need to use the position of your GameObject as the position argument and you can draw as many spheres as you want. There are other shapes as well, see what fits your needs better.

Read the documentation for an example. Make sure to have your Gizmos activated in the scene mode, otherwise it doesn't appear.

  • Related