Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

4.4 HUD Code No Longer Works


Downloaded UE 4.4 yesterday started creating my project from scratch, copied all my code over, however the HUD drawing code provided in the Third Person C++ Tutorial no longer compiles.

This HUD code has worked as is in 4.2 through 4.3.1 and is from the video tutorial.

 class TEST1_API ATest1InfoHUD : public AHUD

This code was using the Canvas property from parent class AHUD to obtain the screen size however this code now gives the following compiler error

 1>D:\Development\Unreal Projects\Tutorial\4.4\Test1\Source\Test1\Private\Test1InfoHUD.cpp(34): error C2027: use of undefined type 'UCanvas'
 1>          D:\Unreal Engine\Unreal Engine\Unreal Engine\4.4\Engine\Source\Runtime\Engine\Classes\GameFramework/Actor.h(1938) : see declaration of 'UCanvas'
 1>D:\Development\Unreal Projects\Tutorial\4.4\Test1\Source\Test1\Private\Test1InfoHUD.cpp(34): error C2227: left of '->SizeX' must point to class/struct/union/generic type

And in VS2013 it unders lines Canvas with a red squigly

alt text

If I remove the code referring to the Canvas property, I now get another error for obtaining the Font in the constructor

 static ConstructorHelpers::FObjectFinder<UFont>HUDFontObj(TEXT("/Engine/EngineFonts/SmallFont"));

The compiler error is

 1>D:\Unreal Engine\Unreal Engine\Unreal Engine\4.4\Engine\Source\Runtime\CoreUObject\Public\UObject\ConstructorHelpers.h(92): error C2664: 'void ConstructorHelpers::ValidateObject(UObject *,const FString &,const TCHAR *)' : cannot convert argument 1 from 'UFont *' to 'UObject *'
 1>          Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
 1>          D:\Unreal Engine\Unreal Engine\Unreal Engine\4.4\Engine\Source\Runtime\CoreUObject\Public\UObject\ConstructorHelpers.h(85) : while compiling class template member function 'ConstructorHelpers::FObjectFinder<UFont>::FObjectFinder(const TCHAR *)'
 1>          D:\Development\Unreal Projects\Tutorial\4.4\Test1\Source\Test1\Private\Test1InfoHUD.cpp(18) : see reference to function template instantiation 'ConstructorHelpers::FObjectFinder<UFont>::FObjectFinder(const TCHAR *)' being compiled
 1>          D:\Development\Unreal Projects\Tutorial\4.4\Test1\Source\Test1\Private\Test1InfoHUD.cpp(18) : see reference to class template instantiation 'ConstructorHelpers::FObjectFinder<UFont>' being compiled

Again, this code worked fine before 4.4 release.

Any help gratefully received

Product Version: Not Selected
canvaserror.png (4.2 kB)
more ▼

asked Aug 18 '14 at 01:02 PM in C++ Programming

avatar image

596 31 77 51

avatar image Tim C ♦♦ STAFF Aug 18 '14 at 03:59 PM

Hi SolarVelocity,

When you mention to the "Third Person C++ Tutorial," is this the tutorial you are referring to?

avatar image SolarVelocity Aug 18 '14 at 04:16 PM

No, I was referring to the Introduction to UE4 Programming video tutorial in the UE4 Tutorial You Tube channel

avatar image SolarVelocity Aug 18 '14 at 04:17 PM

Oh, I just realized your link is a page of links to the videos ... so yes that tutorial

Introduction to UE4 Programming - 17 - Coding a Canvas HUD

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Hi SolarVelocity,

I went through the tutorial this afternoon, and it looks like there were a few header file changes in 4.4 that threw off the Canvas code in the tutorial. In your TutorialCodeHUD.cpp file, add the following includes:

 #include "Engine/Canvas.h"
 #include "Engine/Font.h"

When you have added those lines, you should be able to build the project successfully. Please let us know if you run into any additional issues.

more ▼

answered Aug 19 '14 at 10:27 PM

avatar image SolarVelocity Aug 19 '14 at 11:03 PM

That works ... thanks very much for you help in this matter :o)

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question