您的位置:首页 > 产品设计 > UI/UE

UE4中GameInstance和GameState区别

2016-05-11 16:50 531 查看
1.

Game State:

GameState is replicated extension of GameMode, since GameMode it self is not replicated and exists only on servers memory for security reasons. So GameState let clients access some game data which you would normally place in GameMode, primerly scores and
match time, stuff that you usually see on scoreboard. This is only info that client will have and GameMode should have info which only server should know. You can ignore GameState if you creating single player only game.

Games Instance:

GameInstance is a class that which state persists switching of levels, game mode switches etc. where classes like GameMode or PlayerController are being reset and any data stored in them is deleted and put to defaults again. Any data that you want to keep
beyond levels and matches, for example "what player did in specific moment so you can have consequence on other level" should be placed here. This class is mainly helpful for single player games... but it can find uses in multi player too ;] I not sure if
that class is replicated

For UI of multiplayer game you should use GameState and PlayerState ofcorse

点击打开链接https://answers.unrealengine.com/questions/189120/whats-the-deferent-between-gamestate-and-game-inst.html

2.

Games Instance:

One of the new UE4 engine features as of 4.4 is the Game Instance class!

This is a globally accessible instanced UObject that can store any data you want to be carried between levels!

Where formally you would have had to write out data to a config file or to binary file, to transfer between levels, now you can use the Game Instance class!

API documentation:
UGameInstance

Game State:

The GameState is responsible for monitoring the state of the game on the client.

Conceptually, think of the GameState as the state of the game. It can keep track of properties like score, list of connected players, number of caps in a CTF game, where the pieces are in a chess game, what missions you have completed in an open world game,
etc. In general, the GameState should track properties that change during gameplay. The GameState exists on the server and all clients and can replicate freely to keep all machines up to date.

点击打开链接https://answers.unrealengine.com/questions/259371/game-instance-and-game-state-difference.html

Games Instance:
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: