Cannot set actor references in Game Mode

I seem to be unable to set references of actors in scene to variables in my game mode. My custom game mode has a component actor that contains the reference variables, and when I click the drop down and select the actor I want, it doesn’t save any changes. It remains as none. I’m not entirely sure what the problems is. Yes, the variables are public and editable.

EDIT: Updated screen shot

I am not 100% on this but I believe this is because Actors are not the same for all connected players, loaded on client then replicated to represent the servers version, therefore a reference to it in GM would be redundant. You should try make actor references in the Level Blueprint or where necessary for interactivity, the Character or Pawn BP.

Will I be able to get a reference to the level object to get my actor variables then?

The problem is, that the GameMode isn’t spawned yet. You can only set Reference to other spawned Actors within a spawned Actor. The GameMode will be spawned during runtime, so it simply doesn’t exist yet.

You need to get the references differently. One way would be letting the Objects register themselves in their “BeginPlay” function. They can “Get the GameMode” and enter themselves into the Variables you need.

1 Like

What I’ve found out is that since Game Mode can’t hold references to on scene actors, I’m left with putting those variables in another blueprint. The level blueprint isn’t an option because I have objects containing data as actor components which isn’t supported in the level blueprint.

My scene calls for 5 actors on scene that change color based on variables contained in these components that are on my custom game mode. What I did instead was instead of the component itself changing the color of a select actor, I put the color changing logic on the actor itself. So its the actor that needs a reference to the game mode instead of the other way around. This is what I have done instead.