Editing this value in a Class Default Object not allowed?

I ported my game from 4.17 to 4.20, and a core functionality broke. I had an array of actors of a class “PuzzleBlockGrid” in my level blueprint. This worked in 4.17, but in 4.20, although the previously set array elements have stayed, I can’t add more actors; the new elements stubbornly remain blank. The dropdown and pick tool are greyed out, and mouseover shows this: “Editing this value in a Class Default Object not allowed?”

I also tested with a single valued variable, and it’s the same.

Is this a bug, or deliberate, and if yes, what’s the recommended way now in 4.20?

Here are the things I tried:

  1. Make a new array in the same level for the same actor BP. Didn’t work.
  2. Make a new array in the same level for a different test actor BP. Nope.
  3. Make a new project, a new array in the level and a new test actor BP. Still the same.

I’m not sure what I’m missing. Does it work for other people? It should be right? A friend of mine also has the exact same issue, which was actually where I noticed it first.

Is this a bug?

This is also happening to us on 4.20.1. I think it was an oversight to this issue:

UE-60132 claims this is by design:

Going forward with 4.20 you will only
be able to set actor references on an
instance of a Blueprint in a level,
but not in the class defaults of a
Blueprint.

…but it seems like this must be an oversight, since there’s no instance to edit way to edit in the level, for level blueprints.

Similar question, for level blueprints specifically: No editable arrays in 4.20? - Editor Scripting - Unreal Engine Forums

So the only to do that now is to makeArray on BeingPlay? (as also pointed out in the linked answer above)

Yes, if you want the array in the level blueprint itself set…
Or you could potentially create a proxy actor to place in the world and add an array variable to that instead. That way the interface would be similar for setting up the references, and in the level blueprint you’d just pull the variables off that actor instance instead of from the level blueprint’s variables.

Make both blueprints child class.

Your variable type is object, it needs to be class. Object means an instance, but since a Blueprint is a class an not yet an instance, it can’t reference objects, only other classes.

Set it to Class Reference, recompile and you should be able to define the array now

3 Likes

This does not accomplish the desired outcome. The issue is that this is not just any class blueprint, it’s a level blueprint. Since there is no instance of the class in editor to click on, this is like having both the class and instance all in one. Effectively a blueprint singleton. And since there is no instance of the class in the editor to edit, the only way to edit these values is on the class defaults which, prior to UE 4.20, worked fine.

After having made the child class of my blueprints, all worked well; until today. I added a second instance of the child class BP to my level and it would not allow any reference to be made (editing this value) to the variable that is set to type object (a specific BP). After working with this for a few hours, I changed the variable type to soft object and that seems to have solved the problem. I did have to edit the existing blueprints to re-link the variables in my scripts and UE4 automatically added a conversion node to convert the reference from a soft object to a regular object.

At the moment, all is working as expected for my level. This is simple direct blueprint communications; one blueprint getting a reference to another.

I tested the Level Blueprint, it works as I described. If the OP tanmayb changed the variable type to a class type, they might lose the populated fields, but it seems like they will be able to repopulate them.

Yes, it is editable… but it is not accomplishing the same thing. The intention is to be able to populate the array with references to instances that exist in the level, not the type of class they are.

This seems like it must be the intended way to do this now. I am upvoting this answer.

I believe with this you will need to be careful to not use the reference too soon after streaming in the level, if it is a streamed level. The reference may be invalid if used in BeginPlay.

Oh I thought the OP was after classes, not instances. Yeah I guess that doesn’t work then

Warning!!! Using Soft References can actually cause issues when playing from editor! (UE 4.20.3)

The soft reference apparently can link to the “editor world” version of an actor instead of the “pie world” version. We ran into this when trying to call UGameplayStatics::GetPlayerPawn( GetWorld(), 0 ) from the soft referenced actor. GetWorld returned was the Editor version, so no PlayerPawn could be found!

Wow, thanks for the head’s up. I have moved on to other things at the moment but I will be sure to address this when I get back to that part of my project.

Thanks again for your insight.