MRCookie
(MRCookie)
August 13, 2015, 10:56am
1
Hello!
I tried to check, if some object belongs to specific class. My code:
if (object->GetClass()->IsInA(APointOfView_System::StaticClass()))
This is part of a blueprint function, which looks like this:
(Get Object Type)
There was no errors during compilation, but when I launched my game, all i’ve got was instant crash.
Is there something, that i’m doing wrong?
Thanks in advance, Cookie.
joeGraf
(joeGraf)
August 13, 2015, 5:31pm
2
You aren’t checking object for null. Change your code to the following
if (object != nullptr && object->GetClass()->IsA(APointOfView_System::StaticClass()))
MRCookie
(MRCookie)
August 13, 2015, 9:05pm
3
Yes, that was my problem. I solved it by making a branch with condition pin connected to “Return value” output from LineTraceByChannel. But this solution is much more elegant, thanks!