Is it possible to know if Construction Script is running in edit mode or in game?

Is this possible?

I will explain what I’m trying to achieve, maybe there’s a better way.
I have this coins that the player can pickup, but instead of placing them one by one on the map, I want to be able to spawn coins along an spline.
So I created a Coin Spawner BP that I can place in the map, adjust the spline and automatically spawn the coins.
This works, no problem.
But I want the coins to be visible while I’m editing the spline in the editor. I can’t spawn the coins in the Construction Script, so I added static mesh components instead of using spawn so I can see the coins. This works too, but the thing is: in the editor (and only in the editor) I want to add the static meshes but in game I want to spawn the coins in begin play.
If there’s a way I can know if the construct scrips is in edit mode I can add the static meshes only in edit mode.

You can add the meshes as components, and when you’re ready use an editor mode custom event to change them into meshes.

image

I’m not quite sure why you would want to change them to meshes, but then get rid of them and spawn them again on begin play, but…

That’s because I want to see how to coins will look when I’m editing. The only way I could find to show them while editing was adding them as mesh components (only while editing, in game I want to spawn coins as they are Actors).
Here, I’m editing:

image
This coins will spawn on begin play.

But you also want to spawn them as meshes in construction?

Ok, I get it.

Just spawn them on begin play and remove the components.

If there’s no way to know, then this would be my plan B.
I guess plan B it is.

I’m going to do better. I can spawn the coins and simply destroy the spawner.

:ok_hand: