Lecture 198: Unreal Engine 5 C++ Developer: Learn C++; End game widget problem

Hey, i have strange issue because im pretty sure did all same as Samuel but when game is end, to my viewpoint are adding win and lose widgets. Kinda weird and i dont know why

Also i tried to implement pause from cpp and it seems i need to include smth. I included .h frome documentation but still errors, why?

Need help!

EndGame problem:




Pause problem:


image

I tried debuggin and
image
I think maybe bIsWinner is reading → player - lose, ai - win so add to screens? idk, still dont know how to fix that. And also after dead my game isnt restarting after “RestartDelay”

After 2 hours not null instead of is null :skull: :skull: :skull: :skull: :skull: :skull:

But still problem with pause

You’re attempting to call those functions in a AShooterCharacter member function but those are non-static member functions of AGameModeBase and APlayerController.

#include doesn’t do what you probably think it does. It doesn’t mean you can call them whenever you want, it just copies the contents of the file. You need to call them on instances of those types. Consider the following

// Vector2D.h
struct IntVector2D
{
    int X;
    int Y;

    int Length() const { return sqrt(X * X + Y * Y); }
};

// Character.cpp
#include "Vector2D..h"

void Character::Move()
{
    Length(); // Character has no Length() function

    IntVector2D Vec{1, 2};
    Vec.Length(); // calls IntVector2D::Length()
}

You need to get the game mode and player controller and call those functions on them.

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms