Why is my Actor flickering when in Editor?

Hello, I have an odd actor flickering issue in my editor.

I have an asset, derived from UObject.
I have an actor, derived from AActor. Asset is associated with actor via broker, so when you drag asset into editor, it automatically spawns an actor.
I have a component, derived from UMeshComponent.

When asset is dragged into editor window, actor is instantiated, and corresponding component is created and set as a root component. In component I do override CreateSceneProxy, which creates the data for rendering. No material is assigned.

Odd issue is, whenever actor is selected, geometry is rendered fine. When it is not selected (something else in the scene is selected), my actor is constantly flickering, as if it’s rendered every 2nd frame.

What am I missing?
Thank you!

#Custom UObject Needs Bounds Function

I had a similar flicker issue with levels


You need to ensure that UE4 knows the bounds of your UObject!


Add this function to test, in your UObject class , it makes the bounds the size of the Universe (will want more accurate bounds later, this is just a test)

#.h

protected:
	// Begin USceneComponent interface
	virtual FBoxSphereBounds CalcBounds(const FTransform & LocalToWorld) const OVERRIDE;
	// End USceneComponent interface

#.cpp

FBoxSphereBounds UJoyDrawComp::CalcBounds(const FTransform & LocalToWorld) const 
{
    const FVector UnitV(1,1,1);
	const FBox VeryVeryBig( -UnitV * HALF_WORLD_MAX, UnitV * HALF_WORLD_MAX );
	return FBoxSphereBounds( VeryVeryBig );
}

That worked, thanks! I tried something similar - but the object wasn’t rendered at all. I found that if you do this and put your object too far in the scene, geometry is not rendered. Will look more into this.