Mass Battle Frameworkv1.20.0

UMassBattleDataAssetBase

UCLASS

Source/MassBattle/Public/DataAssets/MassBattleDataAssetBase.h

概述Overview

MassBattle 全部数据资产(Agent / Loot / Projectile 配置)的基类,派生自 UPrimaryDataAsset。承载唯一的通用字段 DataVersion —— 数据迁移版本号,0 = 无版本时代。各子类 PostLoad 中以 MB_CURRENT_DATA_VERSION 为门控:每次迁移递增宏并在 PostLoad 末尾追加 if (DataVersion < N) 块。当前迁移实践见各子类(如 1.20.1 枚举子类型 → int32 索引、1.20.2 枚举风格 → int32 索引)。

Base class for all MassBattle data assets (Agent / Loot / Projectile configs), derived from UPrimaryDataAsset. Carries the single shared field DataVersion — the data migration version; 0 = the pre-version era. Subclass PostLoad implementations gate on MB_CURRENT_DATA_VERSION: each migration bumps the macro and appends an if (DataVersion < N) block at the end of PostLoad. Current migration practice is visible in the subclasses (e.g. 1.20.1 enum subtype → int32 index, 1.20.2 enum style → int32 index).

继承Inheritance

UDataAsset → UPrimaryDataAsset → UMassBattleDataAssetBase

派生类:UMassBattleAgentConfigDataAsset、UMassBattleLootConfigDataAsset、UMassBattleProjectileConfigDataAsset。

Derived classes: UMassBattleAgentConfigDataAsset, UMassBattleLootConfigDataAsset, UMassBattleProjectileConfigDataAsset.

成员变量Members

名称Name类型Type默认值说明Description
DataVersionint320数据迁移版本号。0 = 无版本时代。子类 PostLoad 中以 MB_CURRENT_DATA_VERSION 为门控;每次迁移递增宏并追加 if (DataVersion < N) 块。Data migration version. 0 = pre-version era. Subclass PostLoad gates on MB_CURRENT_DATA_VERSION; each migration bumps the macro and appends an if (DataVersion < N) block.

管线角色Pipeline Role

资产加载时由引擎调用 PostLoad(基类未覆写,由子类实现版本门控迁移);迁移后调用 MarkPackageDirty() 使改动落盘。运行期:Agent 配置经 UMassBattleAgentSubsystem::MakeAgentTemplateDataFromDataAsset、Loot 经 UMassBattleLootSubsystem::MakeLootTemplateFromDataAsset、Projectile 经 UMassBattleProjectileSubsystem::MakeProjectileTemplateFromDataAsset 消费。

On asset load the engine calls PostLoad (not overridden here — subclasses implement the version-gated migrations); after migration they call MarkPackageDirty() to persist. At runtime: agent configs are consumed via UMassBattleAgentSubsystem::MakeAgentTemplateDataFromDataAsset, loot via UMassBattleLootSubsystem::MakeLootTemplateFromDataAsset, projectiles via UMassBattleProjectileSubsystem::MakeProjectileTemplateFromDataAsset.