Can't save map / blueprint with class using EditInlineNew

Hi,

I have a simple class extending Object :


UCLASS(Blueprintable, EditInlineNew)
class MyClass : public UObject

And within a blueprint i have a custom component with an array of those objects :


UPROPERTY(EditAnywhere, BlueprintReadWrite, EditInline, Category = MyCategory)
TArray<MyClass *> MyObjects;

So i can create some simple Blueprint extending “MyClass” and then add them inside the array directly from the Blueprint editor and they get instantiated automatically and appear with this kind of name : “MyClass_C_1”

The problem is i can’t save anymore i have this error when i try :

What should i do then ? Why does he think those objects are from an external map and how can i help the editor find them ?

I can add my object inside the blueprint then save, but if i compile the blueprint and try to save the error appear again It’s like my objects doesn’t exist after compiling the blueprint :confused:

I think the problem is that instances of your Blueprint are not duplicating those MyClass sub-objects - the BP instances are pointing back to the original instances of MyClass in the Blueprint defaults, which are not marked as RF_Public, hence the error. Try replacing ‘editinline’ with ‘instanced’ (or set the ‘DefaultToInstanced’ flag in the UCLASS definition of MyClass).

I tried to put both and also removed the editinline, seems to react the same way. I can add my objects and they appear inside the array as “MyClass_C_1”, “MyClass_C_2”, “MyClass_C_3”… but still refuse to save

The last setup i tried :


UCLASS(DefaultToInstanced, abstract, Blueprintable, BlueprintType, meta = (BlueprintSpawnableComponent))
class MyClass : public UObject


UCLASS(DefaultToInstanced, hidecategories = (Object, LOD, Physics, TextureStreaming, Activation, "Components|Activation", Collision), editinlinenew, dependson = (MyClass), meta = (BlueprintSpawnableComponent))
class MyClassContainer: public USceneComponent
{	

	UPROPERTY(instanced, EditAnywhere, BlueprintReadWrite, Category = Inventory)
		TArray<MyClass*> MyObjects;
}

I did try a lot of different option here and there with no more luck

when i put the mouse over the combo box in the array where i have my object it’s showing where it is.

Before compile of blueprint :

After :

It does seems to be a pretty bad place to be for my object.

I tried to add the “nontransient” but it didnt change the problem.

By the way those 2 pages misspell the word “nontransient” :

https://docs.unrealengine.com/latest/INT/Programming/UnrealArchitecture/Reference/Classes/Specifiers/NonTransient/index.html

I did a simple test, if i put a simple var in my component :


UPROPERTY(EditAnywhere, Category = Inventory)
UObject* item;

it’s working but it’s only a reference to a class in the content browser i can’t edit it but i can save.

Then :


UPROPERTY(EditAnywhere, instanced, Category = Inventory)
UObject* item;

now it’s and object and i can edit it directly inside the blueprint properties, but when i compile it create another name and send it to the trash stuff (see previous message) and then i can’t save…

So i don’t see what to do :frowning:

Bumping because I’ve also encountered this issue. Elzean has done a beautiful job of describing what is going on. I’ve done what he has tried already and it hasn’t worked.

I’m going to continue to search for a solution in the meanwhile. Help would be appreciated.

Seems to be working much better using something like this :


UPROPERTY(EditAnywhere, instanced, Category = Inventory)
TSubclassOf<class UObject> item;

I will keep testing with that for moment !

Note that in this last case you have a reference to the CLASS of an object, rather than an INSTANCE of the object. This certainly a simpler setup, there is nothing to ‘deep copy’ as the class is something that can be shared, but you wouldn’t be able to modify properties of it etc.

Yes i understand, though when i add my object i can add and modify it within the BP like if its a new instance so i don’t know. I can change their default variable icon etc and compile and save. And for moment i didn’t find any other way to make it work.

But yes its not really working with the reference so im not sure what to do then since the other way doesnt even let me save. Here is a picture that might help to understand what i want, it’s also related to the other topic you replied :

When i compile if i have 2 times the same reference they both become identical

I also tried those 2 :


TArray<class MyClass*> MyObjects;


TArray<MyClass*> MyObjects;

they work until i compile the BP where the end up as “trashclass” and prevent me to save the map / BP

Is it possible that the generated instances are garbage collected during compilation or deleted for some reason ?

I’m really desperate here :stuck_out_tongue:

I can’t figure out what is going on…

So i took the same code and put it in an actor instead of a component, this time i don’t have any possibilities to add anything inside my array within the default panel inside the BP but i think that’s normal no ? Anyway then i put my object inside the scene, now that the BP extend my inventory actor i have access to the array within the editor and i can put whatever object and modify properties which is cool, i can even save everything XD

Only regrets is i feel that the same should work as a component, but the compile BP break all the instances, as it is now i need to make all the BP with that same parent and it could be a problem when if i end up in the same situation for another component… I will not be able to choose multiple parents depending on each objects, that what the component BP window is for.

So is this a bug that will be corrected or is it normal that the compilation break my instances ?

This is an old thread, but I’m still running into the original issue where I get Graph is linked to private object(s) in an external package from having a TArray<MyUObject*> MyContainerArray in a component. MyContainerArray is makred with Instanced. MyUobject is set EditInlineNew and DefaultToInstanced.