在 GameStart 上更改 GameMode
Change GameMode on GameStart
我对这个功能有疑问:
UWorld::SetGameMode
我假设有 3 种游戏模式。我怎样才能在我的代码中访问它们并在游戏开始时将其中之一设置为默认值?执行此操作的最佳方法是什么?
您可以使用自己的UGameInstance
class(在项目设置中设置)。在这个 class 中你可以覆盖这个方法:
/** Call to create the game mode for a given map URL */
virtual class AGameModeBase* CreateGameModeForURL(FURL InURL);
并提供您想要使用的任何游戏模式class。
我对这个功能有疑问:
UWorld::SetGameMode
我假设有 3 种游戏模式。我怎样才能在我的代码中访问它们并在游戏开始时将其中之一设置为默认值?执行此操作的最佳方法是什么?
您可以使用自己的UGameInstance
class(在项目设置中设置)。在这个 class 中你可以覆盖这个方法:
/** Call to create the game mode for a given map URL */
virtual class AGameModeBase* CreateGameModeForURL(FURL InURL);
并提供您想要使用的任何游戏模式class。