Hi,
i crerated a custom class which inherits from UObject , but it’s not visible in the Blueprint create menu !
Can’t create a BP based on that class as it’s not visible
Anyone can help with that !?
Hi,
i crerated a custom class which inherits from UObject , but it’s not visible in the Blueprint create menu !
Can’t create a BP based on that class as it’s not visible
Anyone can help with that !?
correct!
Awesome
Really appreciated !
Thank you !
@Roy_Wierer.Seda145 one more question,
i have the asset created now, but do you know now why it’s not visible when i try to load it to the field ?
If that is a property field on the editor panel of type “Object reference” then it makes sense that there is nothing to select. Those objects do not exist at that point, instead you should make the property type “class reference” or “Soft Object Ptr”.
Image by ClockworkOcean:
It is actually a variable in the car controller C++ class
I created a blueprint based on the CarEngine class and i wanted to add it to another blueprint based on this ACarController class from the image !
EDIT : hmm i also created Objcet Reference variable in the car BP to see if i can load it from there but still doesn’t show up
Yes but there is a difference between an object reference and a class reference. To be able to make an object reference to an object, the object must exist. Which means, an object of class UCarEngine must be spawned before a reference to it can be made.
So it you make a property like this you can set the class within Blueprint without requiring a spawned object:
UPROPERTY(EditAnywhere)
TSubclassOf<UCarEngine> CarEngineClass;
With that class, you can spawn as many objects as you like and those objects can be stored in a property of type:
UPROPERTY(EditAnywhere)
UCarEngine* CarEngineInstance;
In blueprint “TSubclassOf” is similar to the purple colored variable where an object reference is the blue color.
using a “TSubclassOf<>” variable actually did the job. I don’t understand how it works in general, but i had it working this way:
UCarEngine carEngine = Cast<UCarEngine>(carEngineSubClass.Get()->GetDefaultObject());
where carEngineSubClass is of type TSubclassOf;
Thanks for the help