GUI/Canvas/Pointer/C++ Issues!

Logs

The first thing to do is start using UE_LOG

I have entire Wiki Tutorial here:


**OnScreen Log Messages**

You can also use onscreen debug messages:

**wiki link**
https://wiki.unrealengine.com/Logs,_Printing_Messages_To_Yourself_During_Runtime#Logging_message_to_the_screen

once you get your own Log setup,

add logs here


void ASSHUD::PostInitializeComponents()
{
    Super::PostInitializeComponents();

**UE_LOG(YourLog,Warning,TEXT("My Very Special HUD Class: PostInit Did Run, Yaaaaay!"));**


    //Grab the PC
    ThePC = GetOwningPlayerController();


    //If the PC isn't null
    if (ThePC != NULL)
    {
        //Grab the custom player controller
        ASSPlayerController* YourChar = Cast<ASSPlayerController>(ThePC);


        //If the custom controller isn't null
        if (YourChar != NULL)
        {
            **UE_LOG(YourLog,Warning,TEXT("HAPPY HAPPY SUCCESS>>>> Hiiiiiiiiiiiiiiiiii Loken!!!!"));**
            //Set it to the global var
            SSPC = YourChar;
        }//if
    }//if    


    //How to Get The Character
    //ASSCharacterClass* YourChar = Cast<ASSCharacterClass>(GetOwningPawn());


}//PostInitializeComponents

If you see the message in blue in your log, or print yourself an onscreen message

then you know that this code ran successfully

otherwise, you’ve narrowed down the issue: the Casting to your custom PC is not working

:slight_smile:


No matter what you should see the Post Init Ran Yaaaay!!! message in your log

if you dont, well then you need to figure that out first :)


Rama