if your game crashes your owner ptr is not valid.
To be sure try this:
if(Owner)
{
Owner->SetActorRotation(FRotator(0.0f, OpenAngle, 0.0f));
}
if your game crashes your owner ptr is not valid.
To be sure try this:
if(Owner)
{
Owner->SetActorRotation(FRotator(0.0f, OpenAngle, 0.0f));
}
That’s the case whenever an uobject isn’t owned by anything. You have to set the owner manually. Actor components do that for you.
Are you creating the component in the actors constructor?
Can you accept the answer by any chance, Thanks
sorry my dude
Hey guys,
Bit of a strange one. Whenever the 1 line function below is called, the editor crashes. OpenAngle is set to 90.f and Owner is set in BeginPlay with GetFirstPlayerController(). Any ideas?
void UOpenDoor::OpenDoor()
{
Owner->SetActorRotation(FRotator(0.0f, OpenAngle, 0.0f));
}
Thanks for the quick reply! That’s stopped the crashing but interestingly that means that
AActor* Owner = GetOwner();
in BeginPlay() doesn’t set Owner. Is there a circumstance where GetOwner() doesn’t work?
ty
it is an actor component, oh no!
ah, there it is. both there and the header file. Such a noob!
Thank you