What object or target to use in order to hide a mesh component from a Camera 2D when "GetParentActor" doesn't work.

I have in my scene a blueprint (BP_ParentActor_Test) which contains a camera of type SceneCaptureComponent2D (BP_Camera_Test). By using the “Hide Component” function I am trying to make invisible to the camera a mesh component (MeshToHideFromCamera) which is in another blueprint (BP_ChildActor_Test), and this blueprint (BP_ChildActor_Test) must be found in the blueprint (BP_ParentActor_Test) which contains also the camera (BP_Camera_Test). So “BP_ChildActor_Test” and “BP_Camera_Test” are found at the same level under “BP_ParentActor_Test”. Unfortunately, I can’t get “Hide Component” to work because I don’t know what to use as object type on my “Cast to BP_ChildActor_Test” node. We see it in the document “20230326_Camera_HideComponent_02.jpg”. The sphere is always visible. On the other hand, if I import the “MeshToHideFromCamera” mesh component directly into the “BP_ParentActor_Test” blueprint and apply the “Hide Component” function using “GetParentActor” on the “Cast To BP_ParentActor_Test” node, it works very well as it can be seen in the document “20230326_Camera_HideComponent_03”.

My problem is that I have absolutely no idea which node object to attach to “Cast to BP_ChildActor_Test” so that the “Hide Component” function can apply to the “MeshToHideFromCamera” object which is in another blueprint.



Solution found: instead of using “Cast to” node in “BP_Camera_Test” to interact with the mesh “MeshToHideFromCamera” inside “BP_ChildActor_Test”, I used “Get Actor of Class”, chose “BP_ChildActor_Test” as the actor class and plugged the mesh in the return node.

One quick note when using “Get Actor of Class” node is that the actor class must be loaded in the level at runtime before the blueprint that includes “Hide Component” gets activated. Otherwise the blueprint will return the error “Access none trying to…”. I found out that even if the actor class is loaded on level after the blueprint is activated, the function “Hide component” works anyways but Unreal returns the error.