Rendering Actor Component Conditionally

My player character has a


UBillboardComponent 

that is used for displaying team colours to other players in a multiplayer game.

I want to make the component only render on players that are on the same team as the player that looks at the component. I looked into


bOwnerNoSee 

and


bOwnerOnlySee

in the


UPrimitiveComponent

and followed the code path hoping that I could get some idea as to how to create custom render conditions but these variables seem to be deeply hidden into the render loop mechanic and I couldn’t get anywhere.

Any solution to this or any workaround will be greatly appreciated (preferably with minimum RPC calls).

I’m on my phone so forgive me if this stupid or not useful. https://api.unrealengine.com/INT/Blu…nts/index.html

There’s probably a C++ equivalent

Thank you for the response but I am afraid this won’t work. Like I said, I need the component to only hide for players that are not in the same team as the player that owns the viewport. Hiding all components would result in hiding the component for everyone including teammates.

You can’t add custom rendering conditions like this. Those conditions are very specific, and used by FPrimitiveSceneProxy::IsShown().

Unless you want to make low-level engine changes, you’ll just have to control visibility manually.

Thanks for the answer.

Would you say the best way to approach this is hide the component for enemies locally on each player somehow or just straight up generate an image on top of teammates’ heads dynamically for each local player?

Just to take a stab at what “render these manually” means for those stumbling upon this. I believe the meaning of this is that we must write custom view logic for these components instead of letting the engine handle it for us. I’m not sure what the implication of hiding a thing in game is but there is certainly a clever way to achieve your described feature w/o making low level engine changes.