Difference between editor and standalone


There is a documentation or any info what are the differences if I want run the game from editor or standalone builds?
I have a raycast code which works perfectly in Editor builds (DebugGame Editor and Development Editor) but crashes in modes without editor.


		const auto* Actor = RV_Hit.GetActor();
		UStaticMeshComponent* HitStaticMeshComponent = Cast<UStaticMeshComponent>(RV_Hit.Component.Get());

		if (HitStaticMeshComponent)
			UStaticMesh* StaticMesh = HitStaticMeshComponent->StaticMesh;
			FStaticMeshLODResources& LODModel = StaticMesh->RenderData->LODResources[0];
			FIndexArrayView Indices = LODModel.IndexBuffer.GetArrayView();

this is a raycast/hit check code fragment.
Indices is correct in editor modes, but NULL in standalone modes, therefore crashes in next lines where I want access it.

thanks in advance,

If you manage to find some documentation do pass that along. Because we have ran into many issues where things work perfectly in editor and do not in standalone. Wait till you start running into issues where things work perfectly in the editor and standalone but do not work perfectly when packaged up for release.

Seems like there is alot of inconsistenecy between what you get in the editor and what the final packaged product ends up doing.

can be a difference in serialization for indexbuffer between editor and standalone code ?
there is a bNeedsCPUAccess boolean which showed by the tooltip of GetArrayView
which used by the Serialize method of buffer…

this boolean seems depends on this>
bool bNeedsCPUAccess = !FPlatformProperties::RequiresCookedData();

and it is confirmed, there is diff:


  •    LODModel.IndexBuffer    {IndexStorage={bNeedsCPUAccess=**false **} b32Bit=false }    FRawStaticIndexBuffer


  •    FIndexBuffer    {IndexBufferRHI={Reference=0x000000000f8405d0 &lt;Information not available, no symbols loaded for UE4Editor-D3D11RHI.dll&gt; } }    FIndexBuffer
  •    IndexStorage    {bNeedsCPUAccess=**true **}    TResourceArray&lt;unsigned char,0&gt;
      b32Bit    false    bool

but where the hell can I set this…? :open_mouth:
or I have to override mesh lodresource serialialization to get index buffer? :frowning:

From what I just went through, it seems like BeginPlay inside the editor viewport has earlier access to resources than even new window PIE.
Therefore some things need a timeout to be ready (like access to the Viewport size).