I want to add a property to a class, which can be set to a Level resource in blueprint editor. But making an UWorld * property allows me to set Level as a value to a property, but I can not save blueprint.
Can I somehow retain a level selection popup, but store only a level name - actually it would be enough for my task.
What type of message are you getting when you try to save the blueprint? I made a C++ class based off Actor that has a UPROPERTY with the specifier EditAnywhere and the type of UWorld*. After setting the value to my new map in the editor, I was able to save without any issues.
Was this blueprint duplicated or created as a child of another blueprint? Have you copy/pasted any blueprint nodes from one blueprint to another? There can sometimes be some reference problems that cause this error message to appear. One possible way to narrow it down would be to save a copy of the entire project and then start deleting any suspecting nodes one by one and attempting to save to see if you receive the same message.
I believe you may be right. If you’re going to be using a workflow where you know the names of the maps at all times, it may be best to use an enumeration or an array of FNames to store the names of the level. You will need to hardcode the names in however, to match the level names. Would this option work for you?
Is solves the problem of setting level references in the editor. But another problem appears - I can not use the value of this property directly form blueprint. Need to write another function which will return FName of FPackageName::ObjectPathToObjectName of referenced asset.