Object finder: cannot convert 'UStaticMesh ' to 'UObject '
The error in the output log:
The code in the constructor:
I also tried my own function but that one gave the exact same error:
It compiled before but I added literally 1 line to the cpp file:
and ever since I can't get it to compile anymore... Not even when I outcomment that newly added line. What am I doing wrong?
Apparently the compiler expects an UObject. UStaticMesh* is an object but... Pressing F12 on UStaticMesh* brings me to a forward declaration in Engine.h. So the compiler does not (yet) know that this in fact is an UObject.
Solution (yes it's very simple):
Of course the question still remains: Why did it compile prior to adding this nonsense line:
And why does it also not compile anymore when I hit ctrl+z until it reverts back to the original state? It still does not compile even though the code is now EXACTLY THE SAME as when it used to compile. BUT when I use SourceControl to revert the exact same change, then it compiles. So even though I found the problem and solved it, there is something much more nasty going on somewhere (and I still suspect a UE4-related bug). If someone figures this out some day, please let me know!
Follow this question
Once you sign in you will be able to subscribe for any updates here