Set blueprint actor variables per level automaticly from e.g. GameState

Hello :slight_smile: ,

I can’t figure out how to do the following:

For example I have BP_Light with condition, and I want to use it in all levels.

My goal is to automatically set the condition according to the level, i.e. in level 1 the condition will be false, in level 2 the condition will be true.

If I set first level to GameState_level1 and the second one to GameState_level2, how do I then automatically assign variable from current GameState to BP_Light ?

Get GameState requires exact casting to a loaded level, which I don’t want. I want it in general.

I just want to store the variables for each level somewhere and then automatically read them according to the set level.

Thank you for your help! :slight_smile:

How are you loading your levels? ( ‘open level’, level streaming, etc? )

When you say, ‘set the condition’, do you just mean ‘on/off’?

Are your lights placed in the level when you made it, or spawned?

It seems to me, you want the light to be on or off depending on which level you load. Is that correct?

Hello,

just opening level.
Yes, light is just for example and test, a just need to set variable with same name and different value for different levels.

Yes, lights are placed in both levels already.

Exactly! This is what i want to do :slight_smile: It´s correct :slight_smile: .

So, assuming the light is a blueprint. In that blueprint, you could say

But it’s a little self-defeating, because you could just put the blueprint in the level, and set the intensity for that level.

I use an approach where I have an actor (aka Level DB/Config) that’s placed in the level. It has custom configurations for all my “Special” actors and events. Game Mode gets a reference to it and then sets the appropriate variables in the GM & GS.

I also use Data Tables for level specific configs. The GM uses a value in the Level DB to read the correct data table.

Oh, it´s elegant solution :slight_smile: ! Thank you.

But, I want something, let´s say “config” file? Where I can set some variables for level 1 with some values and same variables for level 2 with different values.
But i think that this will help to solve my problem.

As I sad, I made light blueprint just for example. I want to use it for control more variables in few blueprints. I will not control lights :).

Thank you!! :slight_smile:

I think that this sounds like somethink that I exactly want. Bud I can´t connect it with blueprints :confused:
I am pure beginner, I started 3 months ago.

Usually, we make a blueprint, with a construction script, and make a lot of variables visible. Then, when you put it in the level, you can configure it to be right for the level. So, the config is sort of stored in the blueprint.

You can do it with a config file that the blueprints read, but why bother?.. :slight_smile: