x

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"

How to Reset / Restart a game

Hi everyone, I've been trying things for days, but I can't solve my problem and I'm a little bit desperate now.

I'm making an endless runner for android, after the player dies I want the game to be reset so the player can play the game again.

Nodes that I used to achieve this goal:

Open Level: Works perfectly in the editor and when I package it for development, It stops working when I package the game for Distribution (Shipping). (Like the node is not there?) 'Cook everything in the project content directory' is set to true.

Execute console command: Works perfectly in the editor and when I package it for development but ofc this node will be removed when I package it for Distribution.

Restart game: Restart game needs a 'Game Mode Object Reference' and when I take the node 'get game mode' it returns a 'Game Mode Base Object Reference' so I can't connect that one?

Maybe there is someone with a different idea to achieve this goal or can help me with the problem i have with 'Open level' and 'Restart game'.

I really hope that someone can help me!

Product Version: UE 4.21
Tags:
more ▼

asked Mar 27 '19 at 04:12 PM in Blueprint Scripting

avatar image

Colder347
146 4 7 12

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

1 answer: sort voted first

Ensure your GameMode's parent class is GameMode not GameModeBase.

Re-parent Gamemode

Then you can cast the current game mode base successfully to GameMode and call RestartGame.

Restart Game

more ▼

answered Mar 27 '19 at 05:14 PM

avatar image

BenVlodgi
2.2k 39 17 52

avatar image Colder347 Mar 27 '19 at 07:35 PM

Thx BenVlodgi, you are a hero! Restart game is now working and it has solved my problem.

avatar image BenVlodgi Mar 28 '19 at 01:32 PM

Glad that helped! :)

(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