fc2ブログ

凛(kagring)のUE5/UE4とゲーム制作と雑記ブログ

2016 年から UE4 / 2021年から UE5 を触り始めました。勉強したもののメモ用ブログです。ゲーム制作に関するメモや雑記とか色々あります。C++ での Qt、Unity もほんの少しあります。

PREV | PAGE-SELECT | NEXT

≫ EDIT

UE5/UE4 Actor などの生成周りでのライフサイクルについて(Actor.h、Actor Lifecycle)

Actor などの生成周りでのライフサイクルについてのメモです。

とはいえ、「Actor.h」に記述されているのでそれの抜粋です。
詳しくは上記ファイルや公式ドキュメントを見てみたほうが良さそうです。

公式ドキュメントはこちら。

・アクタ(Actor)
https://docs.unrealengine.com/5.0/ja/unreal-engine-actors/

・アクタのライフサイクル(Actor Lifecycle)
https://docs.unrealengine.com/5.0/ja/unreal-engine-actor-lifecycle/

というわけでヘッダーの抜粋です。見やすいように成形しています。

・UObject::PostLoad:
For actors statically placed in a level, the normal UObject PostLoad gets called both in the editor and during gameplay.
This is not called for newly spawned actors.

・UActorComponent::OnComponentCreated:
When an actor is spawned in the editor or during gameplay, this gets called for any native components.
For blueprint-created components, this gets called during construction for that component.
This is not called for components loaded from a level.

・AActor::PreRegisterAllComponents:
For statically placed actors and spawned actors that have native root components, this gets called now.
For blueprint actors without a native root component, these registration functions get called later during construction.

・UActorComponent::RegisterComponent:
All components are registered in editor and at runtime, this creates their physical/visual representation.
These calls may be distributed over multiple frames, but are always after PreRegisterAllComponents.
This may also get called later on after an UnregisterComponent call removes it from the world.

・AActor::PostRegisterAllComponents:
Called for all actors both in the editor and in gameplay, this is the last function that is called in all cases.

・AActor::PostActorCreated:
When an actor is created in the editor or during gameplay, this gets called right before construction.
This is not called for components loaded from a level.

・AActor::UserConstructionScript:
Called for blueprints that implement a construction script.

・AActor::OnConstruction:
Called at the end of ExecuteConstruction, which calls the blueprint construction script.
This is called after all blueprint-created components are fully created and registered.
This is only called during gameplay for spawned actors, and may get rerun in the editor when changing blueprints.

・AActor::PreInitializeComponents:
Called before InitializeComponent is called on the actor's components.
This is only called during gameplay and in certain editor preview windows.

・UActorComponent::Activate:
This will be called only if the component has bAutoActivate set.
It will also got called later on if a component is manually activated.

・UActorComponent::InitializeComponent:
This will be called only if the component has bWantsInitializeComponentSet.
This only happens once per gameplay session.

・AActor::PostInitializeComponents:
Called after the actor's components have been initialized, only during gameplay and some editor previews.

・AActor::BeginPlay:
Called when the level starts ticking, only during actual gameplay.
This normally happens right after PostInitializeComponents but can be delayed for networked or child actors.


「Register Component」など、適切なタイミングで行わないとエラーになったりするので
こういったタイミング系の部分はちゃんと覚えておきたいところです。

| UE5 | 10:00 | comments:0 | trackbacks:0 | TOP↑

COMMENT















非公開コメント

TRACKBACK URL

http://kagring.blog.fc2.com/tb.php/723-6d74780e

TRACKBACK

PREV | PAGE-SELECT | NEXT