Hey there, begginer here.
Placed a door, trigger volume that opens it after you go over it by adding a c++ component. Works great, but when I add another trigger behind the door that is supposed to close it and type the code for it it won’t compile or even open in Unreal Engine anymore.
I have tried: rewriting the code, restarting my pc, repairing/reinstalling both Visual Studio and Unreal Engine, mess around with NMake paths (not sure what I did anymore its been a week+ of trying whatever I could. I would appreciate every info, or advice on what to include here to make it easier for you to see whats wrong.
My code: .[h][1] [cpp][2]
From the log looks like it’s a very simple issue to solve, but I wanted to point out a few tips before giving you the answer:
Do not even waste your time looking at the Error Output window, close that because it’s not going to help you when using Unreal, instead keep using the output log just like you did right there.
Try to assign nullptr instead of the NULL macro, it just sticks to the UE4 coding standard
Keep a close look at the error code, you can easily find the issue if you read closely
Now the issue is on CloseDoor.cpp(31): error C3861: 'GetOwner': identifier not found.
Looks like you are trying to access GetOwner from the Pawn/Character? (just my guess because the issue is on the .cpp not on the header). What comes to my head is that you are not including the header file from the Pawn you are calling this function on thus the compiler doesn’t know anyhing about a GetOwner().
If you ever need more help I’ll drop you a link to an useful discord chat with a community of devs that can help you with these issues as well: http://unrealslackers.org/
The identifier not found - because on line 28 there is a function declared - and not an implementation of the desired method.
The function has nothing to do with class methods, it is just a plain C function.
So GetOwner is not related to the AActorComponent and thus undefined.