Can't save due to "Graph is linked to external private object"

Dear community,

I have developed a little blueprint function library class that when used it causes the editor to not be able to save:

40519-message.png

The code below is a blueprint function call:

UCLASS()
class TESTPROJ_API UMyBlueprintFunctionLibrary : public UBlueprintFunctionLibrary
{
	GENERATED_BODY()
	
public:
	UFUNCTION(BlueprintCallable, Category = "VictoryBPLibrary")
	static UFlowerObject* CreateFlowerObject();
};

The “can’t save” problem starts as soon as I set the return value of CreateFlowerObject into a variable:

ie, deleting the “Set” node and recompiling BP solves the problem

Another thing i noticed is that everything is fine when the blueprint chain is constructed inside the level blueprint.

I don’t assume it’s an engine bug, I’m probably doing something wrong, the question is what is it that I’m doing wrong.
Help anyone?

[Attached is a test project][3]

2 Likes

What version you use, they fix this in 4.7.3, something about you cant save if you use 1 function on other function on the same blueprint library.

I’m using 4.7.6

I’ve seen this before when adding a blueprint accessible function/property to an object that is already referenced in an existing blueprint. The only work-around I’ve found is to simply tell it to not save and re-launch the editor, at which point you can have it restore the work in progress if needed and it will then save properly. Really annoying.

For couple of reasons I’m not sure if this is the case here.
First, even after closing and re-opening the editor, the problem persists.
Second, The function is not referenced anywhere else apart of what you see in the screen shot.

Hi T.L.M,

I downloaded your test project and attempted to reproduce what you’re encountering but I was able to save without any issue.

To be exact, after loading up the project, I made an actor blueprint and then added the ‘Create Flower Object’ blueprint node in the Constructor Script. After attaching the Constructor Script to the Create Flower Object pin, I dragged off the ‘Return Value’ pin of the Create Flower Object and selected ‘Promote to Variable’. After this, the blueprint looked like your picture does. I attempted to compile and then save without any issue.

I know your steps are pretty basic but are there any other details that may be omitted? It’s possible that I missed a step that you are taking that is causing the inability to save.

I’m doing the same, the only thing I’m sure is if you added the actor to the scene.
Things do not go wrong until you actually add the actor to the scene.

Hi T.L.M,

Of course it was something so simple. You were correct, the actor wasn’t in the scene. I reproduced the issue from your test project and a fresh project of my own.

I have entered your issue into our database to be fixed in a future update. For your reference, in case you ever need an update on the bug’s progress, the bug number is UE-14581.

Have a nice day,

Using CreateObject and assigning the resulting UObject to a variable in a Blueprint is not correct. The Generated UObject will be placed in the transient package while the instanced Blueprint will be in the Map’s package. The UObject reference cannot be saved because of the dependency and this is entirely expected.

If you want to create an object, you should have it’s outer be the Level. This will ensure that the instance of the Blueprint and the UObject exist in the same package when saving the map.

how do you make the level the outer?

Something as simple as GWorld->GetLevel(0) will retrieve the global level of the current GWorld.

However, it’s not entirely advisable to use GWorld (we try and limit the use of it internally for more robust code that can utilize multiple UWorld’s).

Passing in an Actor and using GetLevel() on it will retrieve the ULevel it is a part of. You would require to have an Actor capable of being sent when you call the function, however.

thank you very much
for my purposes i’m only going to have one world so I think the GWorld will work fine

my code now looks like this:
return NewObject(GWorld->GetLevel(0));
but it still won’t let me save

You get the same error as previously posted? I cannot reproduce this issue after pulling down your project and making the change.

Check that the object created by NewObject’s outer is not the transient package (and further, that the outer’s outer and up the chain as much as may be needed, is not the transient package).

There may be some corruption due to more clean-up of the Blueprint instances already placed (if any), so you could try a new level (and perhaps a new Blueprint) to see if the issue lingers. With the code provided, the object should no longer be a part of the transient package.

since this issue is happening in my level blue print am I able to get a new level blueprint? for the same level?

I’m more curious whether or not the issue can be reproduced in an entirely new level. It’s not possible to get a new level Blueprint for an existing level. This will help us determine if there is level corruption occurring or another issue entirely.

Knowing the return UObject of that function’s outer is also important. The code is specifying the outer to be the level but if you are still getting the error message we are still creating a UObject that exists in the transient package.

Yeah, I can have a look at the current Blueprint. If it’s for the same project originally supplied, I should be able to verify whether the code change resolves the problem.

would you like to see my blueprint then?

Mine is a different project than the one supplied
Tell me if you need more of the blueprint than this

In the original supplied project, if you make the code change to use the ULevel as the Outer can you reproduce the issue still?

After the code change, there should not be a problem with references linking to the transient package. At some point in your code, a CreateObject must be letting the object be placed in the transient package. Or through some other means (DestroyObject uses may lead to the problem, or Rename).

I can’t tell what the problem is without seeing the full project or repro steps that continue to occur after the suggested code change.