What to use as position objects for a sprite to move to?

What do people like to use for VISUALLY setting multiple destination “targets” that a sprite can move to? Here’s what I mean:

Let’s say you have a sprite and you’d like to have 5 positions on the screen that the sprite could move to. Instead of keeping an array of coordinates, I’d like to use objects that I can see in the editor but not see in the game. The reason for this is it makes it easy for a designer to just move the objects and that changes where the sprite can move to. No recording/entering in of coordinate values is necessary this way.

I was thinking of using empty GameObjects but they are invisible if they are not selected. I was wondering what experienced people tend to use. A box? Or perhaps there is “helper” class of objects in Unity that I am overlooking?

I’ve looked into the Navigation options but they seem specific for 3D characters and way point systems.

Thank you for your input.

Gizmos. They are only visible from within the editor but the GameObject will remain.

https://docs.unity3d.com/ScriptReference/Gizmos.html

Edit: Updated to make it less confusing.

3 Likes

thanks but gizmos cannot be created and used as gameobjects.

I’m looking for best-practices for setting up target location that a sprite can move to.

Add a sprite for every ‘target’ you need. Don’t texture, but color to a contrasting color to your scene. The default white should work in most cases.

Place all targets where you want them in the scene and test in your scene.

If your satisfied with target locations, simply turn the alpha for each sprite to transparent.

1 Like

@Bill_Martini Thanks!

The Adventure tutorial goes over this as well.

I would suggest using a GameObject with a gizmo on it instead of a Sprite. Gizmos will acrobatically be pulled out of your build. Sprites will not, and may cause issues down the line.

2 Likes

Just read my post again and realized the wording was awful. Gizmos are only visible from within the editor but the object the script is attached to will remain in the scene. I’ll update my post to clarify that.

i usually use empty gameobject with icon assigned (from that inspector dropdown),
and combine with editor script to draw gizmo lines between children of “TargetsFolder”
(so can see line going from target 1-2-3-4…)
2961667--219866--upload_2017-2-16_15-37-25.png

4 Likes