[Plugins] How to know what needs to be added to build rules and PCH?

I am really struggling while writing a plugin for the editor because I keep ending up with chunks of code that won’t compile, due to errors in the engine itself. Now I know these aren’t problems in the engine code, the real problem is that my plugin needs to add some magical pieces to the build script, as well as to its PCH in order for the pieces to work.

The problem though is, how are you supposed to know what to add?

First I had problems extending ACameraActor, and that was fixed by adding “Engine.h” to my Plugin’s PCH and adding “Core” to the build script. I luckily stumbled upon that in Google. Now I am having similiar issues with IPropertyTypeCustomization throwing errors and I have absolutely no idea what I need to add for that to work.

How am I supposed to determine this? I can’t find anything in the documentation anywhere :frowning:

Ok so in this case I needed UnrealEd.h in my PCH, but my original point still stands. Please tell me there is a better way to figure out this out other than trial and error and lots of head against wall?

Perhaps, this can help -

Figuring out which header to include requires some investigation, lets take IPropertyTypeCustomization as an example.

  1. Find the header that contains the declaration for IPropertyTypeCustomization, it’s in Engine\Source\Editor*PropertyEditor*\Public\IPropertyTypeCustomization.h
  2. Add the PropertyEditor module to your PrivateDependencyModuleNames or PrivateIncludePathModuleNames depending on whether or not you need to link against the module.
  3. Search for includes of IPropertyTypeCustomization.h in the UE4 source to see where and how it’s being included.
  4. Notice that the header is included by Engine\Source\Editor\PropertyEditor\Public\PropertyEditing.h
  5. Search for includes of PropertyEditing.h in the UE4 source to see where and how it’s being included.
  6. Notice that a few PCHs include that header, so add it to your own PCH.
  7. Try to build your project, if that fails look what else if being included before PropertyEditing.h.