Display a sprite in editor for invisible objects (as done built-in on lights) and have it clickable

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By LaserPanzerWal

I hope I didn’t miss an answer to this anywhere here as i couldn’t find one.
I want to be able to display a sprite for objects that are not supposed to be visible in the game, think of spawn points and similar. I do want them to be visible in the editor though so i can see them while building maps. I also want to be able to select them by clicking.

Right now I display them by using immediate geometry and while it does help, it has a few drawbacks as they are not clickable and I need to create distinctive shapes instead of using sprites.

The behavior I am looking for does exist in the engine, as for example lights are a good example of what I want for my objects.

Does anyone know how to achieve this?.
Thanks in advance.

:bust_in_silhouette: Reply From: Vysk

I ended up solving this by setting the sprite to invisible in the _ready function, like this:

func _ready():
	$Sprite.visible = false
:bust_in_silhouette: Reply From: Skelteon

I needed something similar for spawn points in my level and was able to solve this with the following:

func _ready():

It’s very similar to @Vysk’s solution but doesn’t require you to find any particular child node.

Not exactly what I was looking for, but I ended up with a similar solution.
I suppose while this functionality does exist within the editor, it is limited to built-in classes.

LaserPanzerWal | 2021-10-31 17:19