其他分享
首页 > 其他分享> > UE4的World

UE4的World

作者:互联网

1.类图

首先看类关系图

image

2.World

在前面随笔中提到世界是由一个或多个关卡组成。在这里给出部分world的源码以进一步做理解和探究

World代码

World代码过长,只给出部分代码。

/** 
 * The World is the top level object representing a map or a sandbox in which Actors and Components will exist and be rendered.  
 *
 * A World can be a single Persistent Level with an optional list of streaming levels that are loaded and unloaded via volumes and blueprint functions
 * or it can be a collection of levels organized with a World Composition.
 *
 * In a standalone game, generally only a single World exists except during seamless area transitions when both a destination and current world exists.
 * In the editor many Worlds exist: The level being edited, each PIE instance, each editor tool which has an interactive rendered viewport, and many more.
 *
 */

UCLASS(customConstructor, config=Engine)
class ENGINE_API UWorld final : public UObject, public FNetworkNotify
{
	GENERATED_UCLASS_BODY()

	~UWorld();
	
	/** Array of levels currently in this world. Not serialized to disk to avoid hard references. */
	UPROPERTY(Transient)
	TArray<class ULevel*>						Levels;
	
	/** The current GameMode, valid only on the server */
	UPROPERTY(Transient)
	class AGameModeBase*						AuthorityGameMode;

	/** The replicated actor which contains game state information that can be accessible to clients. Direct access is not allowed, use GetGameState<>() */
	UPROPERTY(Transient)
	class AGameStateBase*						GameState;
	
	/** All levels information from which our world is composed */
	UPROPERTY()
	class UWorldComposition* WorldComposition;
	
	/** Physics scene for this world. */
	FPhysScene*									PhysicsScene;
	
	/**
	 * The persistent level associated with this collection.
	 * The source collection and the duplicated collection will have their own instances.
	 */
	UPROPERTY()
	class ULevel* PersistentLevel;
	
	/** Priority sorted array of streaming levels actively being considered. */
	UPROPERTY()
	TArray<ULevelStreaming*> StreamingLevels;
	
	UPROPERTY(Transient)
	class UGameInstance*						OwningGameInstance;
	
	/** List of all the controllers in the world. */
	TArray<TWeakObjectPtr<class AController> > ControllerList;

	/** List of all the player controllers in the world. */
	TArray<TWeakObjectPtr<class APlayerController> > PlayerControllerList;

	/** List of all the cameras in the world that auto-activate for players. */
	TArray<TWeakObjectPtr<ACameraActor> > AutoCameraActorList;
	


标签:UPROPERTY,World,class,levels,world,UE4,TArray
来源: https://www.cnblogs.com/hxhspace/p/16134674.html