Can not set default value of object reference variable

I can not get my variable “newvar_0” to have it’s default value set to the object pawn “Dhunt_camera”. The only way i can get the variable to work properly is to click each instance of the object using the variable in the level and manualy set it’s value to the camera from the level. However, this will not work for an object that is spawned later since it can not find a default value.

Hi Hunkuleswjc,

You can’t create a default value for an Actor that doesn’t exist yet! Instead, you’ll need to get a reference during runtime after it is spawned, and then save the reference in your variable. You can do the same thing for your Actors that already exist in the level in the Construction Script, if you would like, instead of setting the Editable value for the instances in the Viewport.

To do this, your best option is to use some variation of the Get All Actors of Class method. You can read about a few of these options here:

https://docs.unrealengine.com/latest/INT/Gameplay/HowTo/FindingActors/Blueprints/index.html

Hope that helps!