generated.h Not found by plugin

Hi,

I’m using the Wwise plugin in my project and I want to create a sound occlusion/obstruction system,

So what I did is I created a class inheriting from “UPhysicalMaterial”, and added a SoundOcclusion float value. So that’s working great.

Now the problem is that in a class from the Wwise plugin I want to do a Raycast from the sound source to the listenner and if there is something on the way get the “Physical Material” of that object. So I included my UPhysicalMaterial child class (called TNHPhysicalMaterial) in the Wwise .cpp file to cast the original PhysicalMaterial and get my occlusion value like this :

if (OutHit.PhysMaterial != nullptr)
{
      UTNHPhysicalMaterial* PhysicalMaterial = Cast<UTNHPhysicalMaterial>(OutHit.PhysMaterial.Get());
      if (PhysicalMaterial)
      {
          ListenerOcclusionInfo[ListenerIdx].TargetValue = PhysicalMaterial->SoundOcclusion;
      }
}

Now first there is a problem when I include my class with this :

#include "TNHPhysicalMaterial.h"

It doesn’t find the file so what I did was this :

#include "../../../../../Source/TNH/TNHPhysicalMaterial.h"

So it finds it but tells me this :

"Cannot open include file “TNHPhysicalMaterial.generated.h” and the error leads me to the TNHPhysicalMaterial.h

I regenerated the visual studio project files and rebuild the solution but still have the error

Does anyone know what to do ?

Thanks :slight_smile:

Hi. It seems you haven’t include a module contains “TNHPhysicalMaterial.h” file to the dependencies of your plugin. You have to add a new dependency to your plugin .cs build file and then use

#include "TNHPhysicalMaterial.h"

which will be visible to the builder after that.

If your include file is placed into the game module it’s not a good idea to reference this module from a plugin. To solve this you can create an interface gives you possibilities to do what you need (and store this inside a plugin), and then include this interface inside your game and inherit your class from this interface.