Hi,
back to objects again… So i have pretty simple UObject based class(UMyObject) which stores pointer to character(ACharacter for example).
UMyObject is being initialized inside character constructor, object pointer is set inside its constructor via GetOuter().
So what i have here: spawned character has UMyObject, but it’s pointer set to template object, as it crashes engine if i attempt to attach actor to another using the pointer printing corresponding message to the log. It works fine if i set pointer inside ACharacter::BeginPlay. Pseudo code for better understanding:
UMyObject()
{
Owner = Cast<ACharacter>(GetOuter());
}
ACharacter()
{
MyObject = NewObject(this);
}
What actually confuses me here is that this happens only for some of the objects…
I initialize few other objects the same way before initializing UMyObject, and it does not happen for them.
Glad to see any help