Download

Linking variables between BP's - has getting the Object Node functionality changed?

Hey all,

I’ve been watching some (admittedly older) YouTube tutorials on passing variables between blueprints, and I found a couple of methods to get the object node for a specific actor… The easiest I found was to create an editable variable in the calling blueprint, making an Object Reference to the actor, and then, using the eyedropper to select the specific actor to fill in the Default Variable.

Here’s an image so far:

Now, the tutorials I’ve watched (specifically this one, at 7:00: UE4 Blueprint Communication, Casting, Referencing Tutorial - YouTube) show this functionality pretty well, but I’m stuck when I try to do it, as it gives me an error that says “Editing this value in a Class Default Object is not allowed”. The eyedropper is greyed out, and I cannot select the object to create the reference.

I watched another tutorial (this one, at 12:00: - YouTube) which shows the method of selecting all actors of class, manually inputting the index, and setting the variable name to feed the Object Reference to select the specific actor. He comments that it’s “not the way you want to do it”, and never shows the way he would recommend - which I’m assuming is the first process I show above.

In investigating further, someone else who has this issue (link: Editing this value in a Class Default Object not allowed? - UE4 AnswerHub) seems to allude to the fact that the ‘easy’ functionality as above may have been deprecated in a later version of the Unreal Editor.

Can anyone comment on the above? Is this a change to the program rendering these old tutorials moot? Perhaps point me in the correct direction? I’d appreciate some input!

Thanks, in advance!

Rick

You get “Editing this value in a Class Default Object is not allowed” because there is nothing you can reference to. The actor has to be placed on the map first. You need to get the reference in a different way because the level doesn’t know if this actor even exist.

What you can do is place the actor you need in the level and use “Get all actors of class”, but it is also not recommended. I think the best way in your case is to spawn actor from class in the level blueprint. If you don’t want to spawn it from the level blueprint you can use interface to pass the variable.

If I’m not mistaken you are currently trying to set exposed variable inside level blueprint. If that’s the case, than there is your problem. Level blueprint can get direct static reference by selecting an object in world outliner or scene itself and in level BP selecting “create a reference to [Some actor]” but I don’t know the way to get actual variable from level BP to my knowledge. Also the solution that is shown in the first video is by exposing variable inside specific actor not the level BP which is giving you the desired possibility to select the reference via dropdown menu or eyedropper. (Also a little warning. If by any chance the said variable will be set from constructor function the field is also grayed out so you cannot interact with it.)

I hope I haven’t confused anything and this would help.

Hi Mat5i6, thank you for the reply!

I’m sorry - I was trying to actually give you a clean screen without the clutter of the surrounding code on my actual actor blueprint, and mistakenly used the Level Blueprint instead. Apologies! I actually did have the code inside a BP, and just recreated a clean actor as below. (Sorry - Having trouble uploading to IMGUR, so I attached the photo this time around.)

Basically, I created an empty actor, and added Box Collision to it so it would trigger the code once the Player interacts with it. I dropped it onto the Level, and edited the BP behind it to cast to the MgrExit actor, and then I tried to create a Reference to the variable inside it… As the eyedropper is still greyed out, it looks (to me) like the first video’s recommendation is no longer viable…

Not at all! I appreciate the reply!

Sorry I should said it more generally, you cannot set object reference inside BP editor/setup because the engine don’t know what objects are in scenes that this actor will be placed in.
You can only do so after you place it in the scene or change reference type to class/soft reference. But for your purpose you have to place both actors in scene and after that you will find it somewhere in details (in this image case Default > Some Actor Ref and in your Default > Variable For Exit)

I hope this is the solution you was looking for.

ue4selection.jpg

Sir, you are AMAZING! Thank you! I moved to the viewport, selected the “Test Actor” and lo and behold, the variable is now selectable and no longer greyed out!

Thank you so much! I really appreciate it!

Rick

No problem, happy to help if i can.

Also forgot to mention if you want more self setup system (still requires some oversight but it works) you can always setup inside constructor “get all actors of class”, (maybe get the closest one or get first) and set it as your target. Then you will always have some reference for example if you have 100+ lights and one lets say switch for them all so this switch will be set for all lights as you place them and if you want to set it by yourself just add macro “is valid” before get all actors of class and link it to not valid, this way actor will get ref only if it’s invalid so you can make your own ref if necessary.

If you wanted to select objects based on tags that is an options as well. Although it is kinda slow so you prolly wanna keep it off of your event tick.

Also if you wanted a more point and click option for getting an object ref there is this set up as well