No "ATriggerVolume" in Unreal C++?

Hey Everyone,

I’ve ran into a problem with trying to code a trigger volume in lesson #65. I’m using Unreal 4.14.0 and the intellisense in Visual Studio does not understand what “ATriggerVolume” is. I tried to jog VS into displaying the list of viable options as per the lesson and it does not want to fill out ATriggerVolume. When I type it out it just underlines it in red and doesn’t know what I’m talking about.

I wonder if Unreal has replaced the ATriggerVolume class with something else? Perhaps this is something that can only be done in blueprint? Any help is appreciated. Thanks!

Here is my screenshot of the issue in Visual Studio.

Does it compile though? … occasionally things don’t get picked up in VS but it still compiles fine.

Also this might be relevant: https://answers.unrealengine.com/questions/418162/atriggervolume-not-accepted.html

1 Like

Thank you so much for the help! I just tried to compile the code and it still will not compile. I tried to change some of the #includes in the header and it seemed to fix the problem BUT create more problems with the other lines of code. I’m at a stopping point with this course. Perhaps I should just blueprint it.

1 Like

Would you mind sharing your project so I can take a look?

https://drive.google.com/open?id=0B6eN1L3mIwBvZjZUR3BINzBWcG8

I’m not really sure how to share my code so I copied the .git file onto my google drive. If there is a better way to share the files (and I’m sure there is) please let me know. Thank you in advance for looking into this issue!

That wouldn’t be how to share the project. Would need the rest of the folder (the one which .git is in). Or if you know how to set it up with github/gitlab/bitbucket. Just link that.

Remember you can download the instructor’s project from any point in the course and pick up from there if yours has reached a point where you can’t get it working. Of course it’s better for learning to try to resolve any problems that you can, but at least that will let you continue to progress through the course.

I’d encourage you to stick with it, most developers at some stages have those times where nothing seems to work and we question whether we’re cut out for this type of thing! Though if you are really struggling in Unreal but want to get a foundation in games programming Unity is a good option, it has a much smoother learning curve, and learning C# in Unity is probably a better step towards learning C++ in Unreal than blueprints are.

2 Likes

Try to flip the two blocks of code possibly? Lines 26-27 with 30-31. Hope it does something to help.

insert #include “Engine.h” at the top of the include section. You might still get red error lines, but it will compile and you will see the desired outcome in UE

4 Likes

Solved it by adding #include “Engine.h” in ProjectName.h and in the header file I wanted to make a AVolumeTrigger pointer in. Using Unreal Engine 4.16.0

1 Like

I have solved it adding #include “Engine/TriggerVolume.h” myself. It seems this problem will be recurrent every time we’ll be adding instances of new classes.

3 Likes

I also used the #include “Engine/TriggerVolume.h” and that resolved the offending ATriggerVolume* issue, but created several more.

Upon entry of the h code, the GENERATED_BODY on the hfile, and the Super::BeginPlay(); and Super::TickComponent(DeltaTime, TickType, ThisTickfunction); on the CPPfile went wonkers.

Any ideas?

I ended up adding #include “Engine.h” at the top of the header file. I understand that it is not perfect, but it works. Let me assure you (in case anyone doesn’t know) after 20 hours, or so, fumbling around seeking a solution - ANY solution is ok with me.

I have also noticed that Visual Studio (with Visual Assist) often compiles despite errors listed. It also will, after closing and restarting, resolve errors “magically.” It is maddening, but I am thrilled that everything has worked to Section 70 thus far.

3 Likes

I changed
#include "CoreMinimal.h"
to
#include “Engine.h”

This works fine, but you get an error in the Error List in Visual Studio
identifier “FDrawingPolicyRenderState” is undefined

but the Game compile and it works for now.

3 Likes

Using include Engine.h is fine but, as mentioned in the course, it will increase time it takes to compile.
I had issues with declaring ATriggerVolume were solved by using this:

include "Engine/TriggerVolume.h

The problem was using backslash ( \ ) instead of forward slash ( / ) after Engine

2 Likes

I’m working with UE 4.16.2 right now, so I don’t know if this solution works with other versions (it should work with 4.16.x).

Replace the line:
#include "CoreMinimal.h"
by this one:
#include "Engine/TriggerVolume.h"

Remember to include others .h files if you need to. You don’t need to include the whole Engine.h, instead of it, you can include individual head files to decrease your compilation time.

10 Likes

Cheers DrCraconsky, working on my end with 4.16.2 as well.
Hopefully the IWYU compiler update doesn’t cause a spaghetti of #includes as the course goes on lol!

Hello Lagahan!
You will need to include more .h files later. I have eight in one single .cpp file, but it’s easy to find them in the API documentation, you can find them at the bottom of each command page, the “problem” is that you need to include many headers sometimes, but it is still better than include the entire Engine.h.

2 Likes

Hi, guys!

What @DrCraconsky said works great. On UE 4.6.12 now myself. BUT! Be aware that you can do it without changing the CoreMinimal to Engine. (Like a lot of people said, including Engine makes the compile time insane). In short:

  1. Leave the ProjectName.h with CoreMinimal.h

  2. In your header file:

  • Leave the CoreMinimal include at the top

  • Add "#include “Engine/TriggerVolume.h”. But here’s the catch, it has to be:
    -> after *#include “CoreMinimal.h”
    -> but also before any header that ends with .generated (i.e. “OpenDoor.generated.h”)

Visual studio isn’t gonna like it and will mark your UCLASS with an error of the type “Declaration has no storage…” but compile from Unreal and Voala! it works.

All in all, the header file includes look like:

#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "Engine/TriggerVolume.h"
#include "GameFramework/Actor.h"            // this one is for the GetOwner() method in the .cpp
#include "OpenDoor.generated.h"

Other side notes on headers:

  • make sure you use forward slash “/” not backslash “”
  • even if Visual Studio is acting weird, always try to compile straight from Unreal as it even takes less time.

Hope this helps!

6 Likes

Privacy & Terms