Download

How to draw to PDI freely?

I am new to Unreal and I am working on my graduation project with it.
My project is VR modeling, so I need to draw dynamic meshes to PDI in runtime.

https://forums.unrealengine.com/deve…ts-(for-fun)_=
In this topic Rama says how to draw to PDI very briefly. I try my best to learn his way.

I create a class inheriting UPrimitiveComponent, and in its CreateSceneProxy() I can access PDI and draw to PDI without any problem.
So I use a global variation to record PDI and try to draw in other functions.

I attach this UPrimitiveComponent to an actor, and in the actor’s BeginPlay() I called drawSphere() , however, this leads to crash.
Can someone teach me how to draw in PDI? Too little information about it. Thank you very much.