找回密码
 立即注册
查看: 216|回复: 0

Unreal Mixing AGameState with AGameModeBase is not ...

[复制链接]
发表于 2022-8-26 10:46 | 显示全部楼层 |阅读模式
Gameplay用起来很巴适,但是有时候就会折腾一下,然后就遇到一些不注意的东西!
Mixing AGameState with AGameModeBase is not compatible. Change AGameModeBase subclass (bp_BaseGameMode_C) to derive from AGameMode, or make both derive from Base因为项目中并没有使用AGameMode,使用的是AGameModeBase,在AGameModeBase的代码中
/** GameState is used to replicate game state relevant properties to all clients. */
    UPROPERTY(Transient)
    TObjectPtr<AGameStateBase> GameState;
而AGameMode中的是
void AGameMode::InitGame(const FString& MapName, const FString& Options, FString& ErrorMessage)
{
    Super::InitGame(MapName, Options, ErrorMessage);
    SetMatchState(MatchState::EnteringMap);

    if (GameStateClass == nullptr)
    {
        UE_LOG(LogGameMode, Error, TEXT("GameStateClass is not set, falling back to AGameState."));
        GameStateClass = AGameState::StaticClass();
    }
    else if (!GameStateClass->IsChildOf<AGameState>())
    {
        UE_LOG(LogGameMode, Error, TEXT("Mixing AGameStateBase with AGameMode is not compatible. Change AGameStateBase subclass (%s) to derive from AGameState, or make both derive from Base"), *GameStateClass->GetName());
    }
    ...
}
https://ai-gaminglife.hatenablog.com/entry/2018/07/23/115923


所以要求是项目的MyGameMode继承的是哪个Mode,就是用对应的GameState!

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×
懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Unity开发者联盟 ( 粤ICP备20003399号 )

GMT+8, 2024-11-25 06:57 , Processed in 0.089304 second(s), 26 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表