maybe Im doing something wrong but it seems it is not possible to get a object pointer onto a blueprint type from c++?
thus, something like this seems not possible
- Create a ATest : AActor{} in c++
- Create a blueprint BPTest with ATest as parent class
- Add some BPTests into an ObjectLibrary
- Add the object library to another c++ class (-> UObjectLibrary* ol)
- Try to fetch the object with
TArray<ATest *> tarr;
ol->GetObjects(tarr)
This is a valid cast and I dont understand why this shouldnt work. It seems the only workaround is to spawn blueprint types and access their properties that way. but that’s ugly.
Edit 2: The trick is to use the Class Default Object (CDO). This can be fetched with ->GetDefaultObject().
The problem with ue is that the concept of a type and an instance gets blurred and confusing.