How do you remove the blue "Paused" text for when the game is paused in C++?

Hi

I have currently been all over the ShooterGame example code multiple times and cannot seem to find where the text is disabled (as mentioned in the first answer to this question How do you remove 'Paused' text when game is paused? - Feedback & Requests - Epic Developer Community Forums).
I’m starting to lose my mind because either I’m blind and just can’t see it or the function that performs the operation isn’t explicitly named. All I need is for the text to not be there - everything else works perfectly.

I should also point out that I have been working entirely in blueprint so far and would like to avoid using C++ if possible, but I have worked with C++ for two years prior and have no problem understanding how the language works.

If anyone could shed some light on this then that would be seriously awesome!

Try this: You need to get a pointer to the current player’s viewport, then use SetSuppressTransitionMessage();

ULocalPlayer* ThisPlayer = GetWorld()->GetFirstLocalPlayerFromController(); 
UGameViewportClient* TheViewportClient = ThisPlayer->ViewportClient;
TheViewportClient->SetSuppressTransitionMessage(true);

It worked for me. :slight_smile:

Is there a Blueprint equivalent to this? How do we get access to set that variable’s boolean flag in the graph editor?

There is a discussion here about the subject: it seems it is not implemented in Blueprint.

Sorry it took so long to get back to this, but the above solution worked perfectly! It just looks a little different for me because the majority of the game is done with Blueprints. For anyone else in the same boat as me (using Blueprints), create a custom game mode and insert this block of code in the initialise function:

if(GEngine && GEngine->GameViewport)
{
	GEngine->GameViewport->SetSuppressTransitionMessage(true);
}

Again, thanks for the answer to this increasingly frustrating problem DrHobo! Hopefully they’ll add support for this in Blueprint in the future.

Hello EchelonXIII

Can you explain deeply what should I do after I pasted that code into the initialise function.I’ve created new game mode and pasted the code but the text is still there.
I’m very new to C++ coding :), but I really wish to get rid of the blue paused texts.

Can you help with this please. :slight_smile:

12205-screen+shot+2014-08-07+at+21.24.25.png

is this even right(what I did so far).

What you’ve done there is add an “if” statement to your header (.h) file, which generally only holds function declarations (i.e. where you specify what functions the class will have and their parameters). When that header file was created a code (.cpp) file would have also been generated, so the correct thing to do would be to create something like an Initialise function in the header file and then chuck that block of code inside of that in the code file. The following images will demonstrate this

You could even just place the code in the constructor (in my case the AGameModeVikings “function”) if you didn’t want it in Initialise.

Hopefully this has helped, but if you (or anyone else who finds this) are still unclear on what functions are then this is a good explanation: [http://www.cplusplus.com/doc/tutorial/functions/][3]. They have a million explanations for other coding areas as well as some tutorials, so I would definitely recommend that site for any coding beginners!

Sorry mate but i tried what you said and still nothing.
Last time, can you please explain is Step By step.
Here is what i’m doing
i have my project open right I’m using only blueprints.

  1. File-> addCode to the project
  2. i’m choosing game mode class - > choosing where to be created
  3. it asked me whether i want to edit the code or no i’m clicking yes.
  4. i’m edinting the code as you said except for the names of the projects.
  5. Start the game press button i’ve set for pause and then i can see the blue text.

Can you please answer like this step by step .

Best Regards
THX2000

Are you sure you’re sticking the block of code inside the .cpp file? In case you got the images mixed up from my above post, the top image is the .h file and the lower image is the .cpp file. I may be wrong about putting the “if” statement inside the default function that gets created with the .cpp, so if you copy what I have written in my images (obviously swapping AGameModeVikings out for whatever your game mode is called) there is no reason why it shouldn’t work. Other than that the steps that you’ve taken are correct.

If you still have issues after doing that then all I can suggest is creating a new project and doing the same thing there, just to make sure there isn’t something you’ve done wrong in your blueprints.

Hope this helps!

HI EchelonXIII,

NOT WORKING Mate :slight_smile:
i’m attaching the two files(btw i know a lil bit of programming i know about the header file etc.)

After that i compiled the code by pressing this button in UE4 editor.

everything was completed and then start the game i had level blueprint (

) to enable the pause menu and nothing.

So till nothing. Do you have any other suggestions.
Is it normal if I click on the blueprints drop-down to NOT SEE any game mode created ?

Regards

Hi Mate after saving and recompile it gave me an error ?

Let me have a shot at this:

I will not discuss the validity of the code you entered or your log messages simply because you’ve started this in bad way since the very beginning. Even though you put the right code in the file, it still may not work. Trying to compile new C++ code through the editor is a no-no; it’s been clearly told many times in Epic’s own C++ tutorials that you can find online here: Introduction to Programming | Live Training | Unreal Engine - YouTube and here: - YouTube

The editor can only compile new code in existing functions and part of your error messages are due to this. Add a variable or new signature and BOOM! Instant incomprehensible messages will spit out in the error log. You need to close the editor, compile it natively then load it in the editor. Larger support for a more “intelligent” hot-reload from the editor is not due before 4.4 or 4.5, I believe.

Also, you’ve added a new GameMode code in your project when you already have an existing GameMode blueprint that might get in conflict with it. It might compile but will it load ? I’m not sure. You’ll need to delete the blueprint and create it again based on your new class without forgetting setting it up as a default blueprint and set all the other classes that need to be attached to it just like the original. Personally, I’ve never tried to add C++ to an existing BP project because it’s so much work. The reverse, however, is trivial.

What I suggest is to follow these videos (try the first one, it’s short and to the point) and learn C++ programming and compiling under Unreal 4 with them, even at its basic level, then start from scratch with a C++ program. You’ll have a default GameMode where you can put the pause code and carry on in Blueprint. Yes, you can mix C++ and Blueprint this way. But you’ll also have a C++ program ready for any additional little trick you might find helpful in the future.

Regards.

@THX2000 So I just realised that I completely forgot to mention that you need to set the game mode to your custom one in the World Settings (or Project Settings->Maps & Modes), then assigning any controller classes or whatnot to that. If you weren’t doing that then that could be why it wasn’t working initially, so my bad :stuck_out_tongue:

But yes, if you follow the tutorials/advice that DrHobo has given then you should definitely be able to get it to work (as well as achieve a better understanding of C++).

Sorry this has taken so long to work out!
EchelonXIII

EchelonXIII & DrHobo …thank you so much guys.
Really, for the time you’ve spend answering me.
I’ll follow your advice and look at these tutors.

Anyway
Thank you !!!

Best Regards
THX2000

Guys it’s me again, probably this is getting pretty annoying but the problem is still there and i think i’m not alone in this situation.
After looked some of the video tutors and checked Strategy game sample. I found something very strange.
So the code in strategy game have this row in the constructor right:

That’s written by Epic you know and when i created the project (strategy-game) just creating and playing. When I pressed the button for in-game pause menu. I spotted the f***ing Blue text again despite the fact i didn’t touched any code inside nothing you know . It’s just not working by default with Epic’s sample. Even when they’ve published the sample explanation they had this image attached:

So, after all, I think there is something strange which I can’t explain.
Can I have your opinions, please.

Thanks.

I’m gonna get technical here :wink:

The SetSuppressTransitionmessage() is set inside the GameMode contructor. Now usually, constructors construct objects and should not rely too much of other objects because there might be a problem in the order each object is constructed or else BOOM! Faulty pointers. The GameMode is set up early in the hierarchy of things to construct so there is probably no engine ready at this stage. And that’s why in this case the GEngine is checked (and the following viewport) to see whether it is NULL or not. If it is, we jump across whatever was inside those brackets. And SetSuppressTransitionMessage() will not be called.

Now, I just ran the Strategy program with the newest 4.4.0 and traced this call. Turns out the condition is jumped over because the GEngine pointer is set to NULL. What happens next is that further down the road, the GameMode constructor is called another time, probably because of some switching to another game mode along the way and then there is a valid engine and GEngine is not NULL and so is its viewport. And SetSuppressTransitionMessage() is finally called. With the 4.4.0 version, the blue text is no more.

But that second call to the constructor doesn’t make things kosher. I don’t know why Epic decided to make such a check there. How I do things is call SetSuppressTransitionMessage() in BeginPlay() or some early function after all is constructed, where I’m sure that everything is setup correctly. I do make a token check to Engine and Viewport, but that’s just me wearing both a belt and suspenders. :slight_smile:

So It’s possible that in earlier versions, or for some reasons due to the environment, only one call to Gamemode was done and it simply failed because Engine was NULL at that moment.

So that’s my explanation. If you still need some help, I can fix a YouTube video or a Google Hangout to set things in the code providing you have your C++ environment up and running.

Regards.

DrHobo,

Mate honestly i didn’t get all of what you said about the first and second paragraph , but on the third one i’m on it :-).

So i’ll try to now to create C++ project and i’ll write Begin Play function there and inside it, i’ll just set SetSuppressTransitionMessage(true) without any condition, i’ll compile and i’ll get back here with screenshots etc. and if this does not work

I will kindly ask you to make on video of what exactly are you doing ,you know because i’m freaking out ,this is so vital part of every game, there has to be solution which even newbie like me can deal with.

Thanks

DrHobo,

If you can go ahead directly with the video, that would be awesome, because after trying wait not in my power i’m obviously, not going to make it by myself :slight_smile:

Best Regards
THX2000

The video is done.

Before you go: FIRST Accept the answer I have given the first time, below this, by clicking on the check mark . Your questions, while interesting and challenging, were off topic and because of that, the question is no longer marked as RESOLVED.

SECOND Any other comments should be directed to the YouTube channel.

I have found a much easier solution for Blueprint users because the others discussed here had side effects on the usage of BeginPlay() in Blueprints.

Regards.