[Closed] CreateRenderState_Concurrent crash
If the editor starting map contains a component that equeues a clear render target (or a canvas draw) in the CreateRenderState_Concurrent, the engine crashes since FSceneRenderTargets::CurrentShadingPath is not initialized (it is equal to 2, so ShadingPath::Num, so the GetSceneColorForCurrentShadingPath's check fails).
Is there any documentation about actor/component calls, or engine flow, that covers at least OnRegister, CreateRenderState_Concurrent?
The question has been closed Jan 04 '17 at 10:50 PM by AndrewHurley for the following reason:
The question is answered, right answer was accepted
I'm not sure there are any documents outlining the information you're looking for. Further, the paths for getting from loading / creating a world to initializing components can be quite divergent depending on how / when you're doing this (e.g. just launching the game from command line may be slightly different than doing PIE).
Can you provide a little more context on when this happens? Is it when the editor first loads, when you PIE, if you launch into the game with command line args? Does this happen in packaged or game builds?
Here's a page describing Actor Lifecycle.
There are another key points to this in regards to your question (but not on that page):
UActorComponent::RegisterComponentWithWorld is called, it will call ExecuteRegisterEvents (and also will conditionally call RegisterComponentWithWorld on child components).
UActorComponent::ExecuteRegisterEvents is called, it will call OnRegister first, and then CreateRenderState_Concurrent.
However, when RegisterComponentWithWorld is called is a little less straight forward.
UActorComponent has a bAutoRegister member (which is true by default). When this is set, the component will automatically register as soon as the Actor is registered. However, when it's false, it's typically up to the owning Actor to manage registration. However, RegisterComponentWithWorld is public because Components can be created dynamically at runtime in a way that is not manager by the Actor.
All of that aside, what you're running into is likely is a callstack that looks something like this:
AActor::IncrementalRegisterComponents ULevel::IncrementalUpdateComponents ULevel::UpdateLevelComponents UWorld::UpdateWorldComponents UWorld::InitializeNewWorld UWorld::CreateWorld
It's also important to realize that UpdateWorldComponents will be called when InitializeActorsForPlay is called (and you can see where that fits in in the Actor Lifecycle docs).
Something you could try to avoid these issues is to disable bAutoRegister on the components with these calls, and defer them until later (see the Actor Lifecycle docs for potential injection points).
Thanks, Jon N.
answered Jan 04 '17 at 10:49 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here