Adding Child Widget based on hit actor/component

not 100% sure what you need but i tried to do what i thought it was. i “may” have overdone it a little, and note that this is not polished, but its more like a proof of concept.

DISCLAMER: i dont like the method of creating a “studio” (you will below a link explaining using a studio to render a 3d image to a widget) and having it floating around, but right now i think its the only way.

LineTrace logic:

  • Hit the actor with a LineTrace.
  • HUDClass has an array of valid actor classes and will compare the class of the hit actor to it.
  • If its a valid class, get the actor and do an interface call,you dont need to cast for this
  • The Actor will send its data stored in a MeshData (struct) variable inside the actor blueprint to my HUDClass. then HUDClass will create a “Studio”, its widget (will be child of a widget containing all the meshes) and update everything it in the struct. Finally it will update its own list (Created Widgets) . then return the updated MeshData and re-store it in the actor blueprint.
  • Finish the trace with Updating the parent widget (if it has been created, dont get confused, as we havent created the parent widget yet, only the children)

PauseMenu logic:

  • Call pause menu event on HUDclass
  • HUDclass has a variable of type w_PauseMenu. if its valid (already created) request update widgets (might not be needed for you, since its on pause, for me, it was a floating menu so i could re-hit other actors with the menu up)
  • UpdateMenu checks if theres a widget in the array of MeshData that is not a child of the Horizontal box (container of all the widgets), if there is, creates a child.

first i understand you need to display the mesh into the pause menu right? not certain how was your approach but i chose this methods (i used the first cause it was the first i found, also, for having multiple “studios” you actually need walls, or you will capture multiple objects)