GetOwner() Not Autocompleting
Hi! I'm new to UE4 development and I've followed Udemy's Unreal Engine Development course. But unlike in those videos I can't get Visual Studio to autocomplete GetOwner() members, functions. The only error I'm getting is Pointer to incomplete class type is not allowed when I hover GetOwner line.
I get the error for example when I try to use the code GetOwner()->GetName() or GetOwner()->GetTransform(). I don't have any troubles when compiling or building everything works fine but for a starter like me autocomplete is a big help.(Without autocomplete it is a bit hard for me to complete the challenges in course videos, learn and get familiar with new classes.)
Note 1: I have tried including my project's haeder file on top of everything but it didn't help.
Note 2: From the comment's in this question it seems this is a UE 4.16 related problem.
Any help is appreciated.
First of all thank you for all of your suggestions. After reading all the comments and the answers I followed your instructions and I'm sharing the results down below:
Also as mentioned by nachtmahr Pointer to incomplete class type is not allowed is not a compile error but I still think this error is related to the main autocomplete problem.
If no one else is having the same problem as me is it better for me to reinstall VS & UE4? (Please note that I created the development enviroment following the instrucions on Udemy Course)
Thanks everyone for your support on helping me solve this problem. I solved the autocomplete issue by adding #include "Engine.h" to the top of my header files. Appearantly having CoreMinimal included is not enoguh. I'm not sure if this was intended or just a mini bug but this method solved the problem for me.
Note: İncluding the Engine header file in only just ProjectName.h file is not enough for solving the autocomplete issue you need to add it in all header files where you are having this problem.
answered May 27 '17 at 10:22 PM
For those having errors not related to Intellisense, it may be because you haven't set an Owner for your object. When you call GetOwner its methods are null. See the declaration: AActor* GetOwner() const; Hence the pointer to incomplete class error.
In this example my Owner is ASpawnHelper* called OwnerObject.
Follow this question
Once you sign in you will be able to subscribe for any updates here