Set default value for a actor variable

Is there a way to change the default value for a actor variable without spawning a actor as a reference? I have a main menu map which has a loadout screen that changes your gun to the one you select in the menu

I though I could just edit the default values but it wouldn’t let me cause I assume you need a reference to that actor, I was just wondering if there was a way to get the reference without spawning the actor.

Many thanks

If I put a cube in my level, in the level BP, I can say:

But I placed the cube, didn’t spawn it.

Is that what you mean?

Not quite I’m afraid, I’m trying to spawn a actor with the details from my “current weapon” actor variable.

What I’m looking for is a way to get a reference to the actor without spawning a actor into the world for a reference too it if that makes sense. I can get pictures when I get home from work on how I got it set up so far in a couple of hours

Make game instance class, it kind of like game mode but it alive all the time and don’t reset. Keep menu selection there, on game start when you set up the gun check selection in game instance if it will be not set (None) then use default varable that you use now

So you want to have a ref, just like you spawned it, but without spawning it? I guess one way would be to spawn it, but keep if off map…

That’s exactly what I want, cause I’m going to have 20+ guns I don’t want to spawn all of them hidden in the map to have the references. I was just Gunna make an array with all the actors as the default values. the only way I could think of was the way you just mentioned, but as stated I don’t want to spawn all the actors just to get the references to them.

Was just looking for a way to make the variable I have set to be the list of “actors/weapons” as default rather than “none”

A references is a Pointer to the memoryadress of that actor. If it wasn’t spawned it simply has None :wink: so no, you can’t have a ref to a Not spawned actor

@adnoh that’s what I was afraid of… thanks for the answers guys

If every Player can have it’s own gun, Set the selected gun class in your playerController. When spawning your pawn you can get the variable from the playerController and Spawn it. A PC ist unique for each Client and is not Killed Like a pawn

but the below answers will fit your needs!?