Can't edit value in a Class Default Object

:chicken: Hello, it’s my first time trying the Blueprints Visual Scripting for UE5 book.
In the chapter 3 I’m taking a FPS template, putting a barrel that should be giving a fire effect then I shoot it.

In the book the description says

“Iin the details panel of BP_Barrel instance, click on the drop-down menu of the BP_Fire variable to list the Actors of the Level that are instances of Blueprint_Effect_fire. Select the instance that we dropped on top of BP_Barrel to assign its instance to the BP_Fire variable”

Below it has a screenshot example like this one, except that in the book def value of BP_Fire can be changed.
Sc1

I tried to change class object, but it seems that this event graph can’t be executed under another class?

My barrel doesn’t start Fire Effect when I shoot it, but i can hear the Fire Sound without it. I couldn’t find any other solution in the Internet, or I couldn’t figure out how to form the right inquiry for search. I’ll be glad to any advises how to fix this.

Here is the log, just for any case, ver 5.5.3

It is a bit complicated due to object oriented stuff and load order, and fact that actors in editor are not actors in game during runtime.

EDITOR LIES!

So you have actors:

  • loaded in editor so you can edit them, some code rune on them but not always, editor PRETENDS all is in level
  • then you have classes and class variables, in actors, those are just code
  • and finally you have actors, real ones in real level, and those have correct variables, and are real actors not faked by editor

So for your barrel to work you need reference to real barrel actor. Else you get bug about null pointer.

Either barrel tells other actor “hi i am barrel, my pointer is: xxx”
or your actor gets all actor of class “barrel” and either explodes all of them or picks correct barrel.

however for you it is simple:

Event Hit returns “other”, which is general pointer that can be anything.
So get that “other” and cast to “barrel class”, which tells unreal this is my barrel dummy!
Then “other” is changed to barrel and you can do barrel stuff with it, like roll.

Hi @aevilida,

The log you have attached just indicates that there was no valid BP Fire set on the Barrel, which lines up with you not being able to set it in the first screenshot.

You won’t be able to set a reference to something in the CDO that doesn’t already exist within the CDO. For example, you can reference a Component inside an Actor, but you won’t be able to reference another Actor in the CDO. The CDO being the version of the object you are actually editing in the blueprint editor.

I’m not familiar with the content of that book, but I’m guessing they are trying to get you to set the BP Fire value to something on an instance of a Barrel, i.e. a Barrel that has already been placed in the world, or instantiated.

It’s normal for the value to not be editable in the CDO, just ensure that Instance Editable is enabled.

Then when you place a Barrel in the world, you will get the option to set your BP Fire variable.

I hope this was helpful!

Thanks,
Hayden

@Nawrot
@HaydenPrismatic

Thank you for your detailed responses despite the poor description from my side, though I’m not sure if I can make any change with them :sweat_smile:

I hope I’ll be able to really explain the issue this time

(Now) I found out that the moment I set “BP_Fire” Variable a type “Blueprint Effect Fire” —> Object reference, its Default Value can’t be changed after. I don’t know if this is just how UE works or if it’s a bug. I supposed to be able to select there an instance of Blueprint_Fire_Effect from starter pack, so like when the barrel gets a shot, it fires, but again, the drop-down menu to set this is inactive.

Different Internet sources say that it should actually work, or maybe I should change the Var. type to Class Reference, but in this case the Barrel’s Event Graph can’t be executed in the way it is (because it uses the specific nod Get: BP_Fire Variable available for Object Reference only). I can’t really use the Runtime because it’s a bit too advanced for my noob level and I believe this exercise must work the way it is?

I already placed the actors in the level, and I checked Editable/Editable when Inherited. I tried setting all the insides before and after placing the actor on the level. And I reread and redid the whole thing several times even on different versions.

I just want to know why it doesn’t work
The Play gives me the same error message, which is obvious yeah

i’d suggest a different method, there are lots of ways to do this but for simplicity.

Create an ‘Effect’ ActorComponent.

The component can spawn/remove effects such as fire.
Attach the component to any actor you want to have effects.
the actor always has a ref to its components and can call functions such as SpawnEffectOfClass OnHit etc