This is not the first time I encounter this behavior.
Variable pointer to an UObject are nullified inside other containers uobject/ucomponent when this conteiner child is implemented with Blueprint.
I’m creating or assigning variables to some UObjects.
But when some functions are then called those variables are nullified.
I put some check to see if those are same containers and they are.
Also class is created with inline editing:
I have a class ULyraInventoryManagerComponent. Its inheritad by a blueprint child B_LyraInventoryManagerComponent
The constructor of B_LyraInventoryManagerComponent is called saving the name of this class to check if values are comming and are assigned.
USTRUCT()
struct FContainer
{
...
SetOwnerComponent(UActorComponent* inOwnerComponent);
UPROPERTY()
UObject * OwnerComponent;
FString TemdDebugNameComp ;
};
UCLASS()
class ULyraInventoryManagerComponent : public UActorComponent
{
...
ULyraInventoryManagerComponent();
UPROPERTY()
Container container;
}
Container::SetOwnerComponent(UActorComponent* inOwnerComponent)
{
OwnerComponent=inOwnerComponent;
if(OwnerComponent)
TemdDebugNameComp = GetNameSafe(OwnerComponent);
}
ULyraInventoryManagerComponent()::ULyraInventoryManagerComponent()
{
container.SetOwner(this)
}
But when a function of this B_LyraInventoryManagerComponent is called next time, then this OwnerComponent is NULL but the name stays as it was set in constructor.