Setting default value of a actor variable

Hey, I’m creating a basic zombie wave game where you start in a main menu level, from here you have 3 options. Training, survival and loadout.

My weapons are child blueprints of a master weapon actor so I can set each one different damages etc… etc…

For my training level you get given a default gun where I spawn the actor from the level and everything works as intended.

Now I’ve moved onto the survival level and ran into a problem. From the main menu I want you to be able to select the gun that you want from the loadout screen and when you launch the survival map you get spawned the gun you selected.

I thought I could just make an actor array and add every child gun actor to that list as a default value. But when I tried that I couldn’t change the default values of the actor array variable… probably because I need a reference to a spawned actor

Is there another way to set the default values? Or would I have spawn in every child gun actor to get a reference?

I don’t know if I understood it completely but have you tried to reference an Object Class (the purple icon) instead of an Object Reference (the blue icon)? Then, when you have to spawn the gun, just use “Spawn Actor at Location” and pass the class reference as a parameter.

You don’t need to have the weapon actors spawned for that. Instead, you can create an array of weapon classes, and spawn the selected weapon type as @ThiagoZoid mentioned. Also as an added benefit, you can loop through it and use the Get Class Defaults node to access all the default values if you want to display information about the weapons.

Alternatively, you can either use a Struct array or Data Table and populate it with information about the weapon. This can be especially useful if you need to display specific UI images/names for each of the weapons in the Loadout screen, since this type of info may not be required as part of the weapon (unlike Damage, Rate of Fire, etc) itself.

There 2 things :

If you wan’t to change some variable when you use an actor spawn node you have to check these 2 box
https://i.ibb.co/zsg1csV/default-variable-1.png

Then you can change these variable in blueprint
https://i.ibb.co/yPM9Q4Y/default-variable-2.png

Btw i can change all my variable in the default blueprint, but it won’t really be dynamic
https://i.ibb.co/zFQdKtc/default.png