How can I save level with c++ actor class?

I have an actor class that holds/ starts all of the world building systems I’ve built in code. If I drag and drop the actor class into the viewport and hit play, everything is fine. But if I save the scene (Ctrl s) then I get this error link . If I’m not able to save with this, is there a way I can have this actor spawn when I build my project so that I don’t have to drag and drop it into the scene everytime I build my project?

Did oyu check if you don’t have any private varables that you access in blueprints or via details tab?

Oh I do have a private uproperty.

UPROPERTY(VisibleAnywhere, Category = Mesh)
	UGenProcMesh* mesh;

Should that not be a UProperty? or can I just change the visibleanywhere flag to fix thi?

Okay so I moved all the private members / methods to public just to test. This does not solve the problem. Maybe this is a dumb question but does this include its dependencies? For instance, that UGenProcMesh is a mesh object from the GenProcMesh.h → I see that it has private stuff in it.

Ah sorry i didnt notice you that it sometimes works and sometimes not :> i will move you quastion to bug raports then

Hello ,

I recently assisted someone with this same error message which ended up being an issue related to how they were initializing their properties. Could you post the code that you’re using? If you’d rather keep it private, you can send it to me in a private message on the [forums][1]. Also, could you tell me what the exact error it is that the editor gives you when you try to save your level/asset? There are a few different versions of that “Graph is linked to an external…” error that point to different problems. A screenshot would suffice since you can’t copy/paste in that window, if I remember correctly.

[1]:

I sent you message on The forums with the code.

Hey ,

We spoke back and forth through private messages about the issue but I wanted to post the information here so the solution is public. The issue ended up being related to how one of your variables of your custom UObject class was being initialized. You were using NewObject to initialize the pointer but after changing that to CreateDefaultSubobject, the issue went away.

You also asked if initializing two variables with CreateDefaultSubobject in a constructor is a bad idea. This isn’t a concern as CreateDefaultSubobject can be seen as similar to NewObject in the fact that is is creating a new instance of a component or an object based off the class given. I believe it actually works in the same way as NewObject but I haven’t looked at the source directly so I’m not sure, but also has the flexibility to work for components.

I generally use CreateDefaultSuboject for any variable that isn’t an Actor reference of some sort.

If you have any more questions, please let me know and I’ll try to assist.