一、WorldContext
1、World世界类型
namespace EWorldType
{
enum Type
{
None, // An untyped world, in most cases this will be the vestigial worlds of streamed in sub-levels
Game, // The game world
Editor, // A world being edited in the editor
PIE, // A Play In Editor world
Preview, // A preview world for an editor tool
Inactive // An editor world that was loaded but not currently being edited in the level editor
};
}
2、WorldContext
WorldContext既负责World之间切换的上下文,也负责Level之间切换的操作信息
二、GameInstance
•GameInstance里会保存着当前的WorldConext和其他整个游戏的信息,
•不管Level怎么切换,GameInstance还是会一直存在
三、Engine
1、Standalone Game:会使用UGameEngine来创建出唯一的一个GameWorld,因为也只有一个,所以为了方便起见,就直接保存了GameInstance指针。
2、而对于编辑器来说,EditorWorld其实只是用来预览,所以并不拥有OwningGameInstance,而PlayWorld里的OwningGameInstance才是间接保存了GameInstance.
四、GamePlayStatics
操作蓝图函数库:
UCLASS ()
class UGameplayStatics : public UBlueprintFunctionLibrary
eg:GetPlayerController、SpawnAcctor、OpenLevel
UE GamePlay框架(八) WorldContext、GameInstance、Engine
最新推荐文章于 2024-04-10 17:14:34 发布