yea tag me when you’re ready for some reason I barely get notifications for all the stuff I respond to
So I’m having some trouble spawning an actor based off the class reference. I come off the For Loop array element from my previous post and Get Class. This gives me the Primary Data Asset class that holds all of my Data Assets. I then try to Async Load it and Spawn an Actor but I’m not sure how to tell it WHAT Data Asset I need it to spawn (as shown in the variable options dropdown).
Doing this with a hard code works (just selecting the data asset manually in the Spawn Actor node and ignoring all the class and set variable logic) so I know the rest of the method is sound, I’m just missing something.
I guess mainly can’t seem to get the Data Asset from the Primary Data Asset except with the “Get Export Text Name” function which I don’t think I can do anything with at least not without manually building a path refefence.
I’m a bit sick today but I try to follow what you wrote and see if I can write a proper reply.
I see a few things going on on that image which aren’t right. When you call “Get Class” on that Asset Data you get a purple pin (hard class pointer). Blue pin is also a hard pointer (object instance pointer). That means it has already been loaded in memory and is ready for use. At that point, converting it back to a soft pointer is pointless. Only if you start with a soft pointer you can optimize the memory, otherwise everything is already loaded in there.
Once you get a purple pin (either directly, or loaded from a soft class pointer), then you would feed that pin into another “spawn actor from class” node, just like how you spawned your spawner before. The output of that is then a blue pin of type Actor.
@Roy_Wierer.Seda145 Sorry to hear that I hope it’s nothing too serious.
Ok so I am taking a different appraoch for now to keep it as simple as possible and can optimize later.
- I Initialize a Static Mesh Object Reference variable in the child widget.
- In parent widget Set that variable to the Mesh in the data asset as it loops.
- Reference that variable later during the OnClicked Event binding.
This isn’t working as intended and only spawning the last Mesh/Data Asset in the loop so I assume it’s not saving indivifdual refeernces in each child widget. I try to access some other text vairables during OnClicked binding and those act the same so it seems once the child widget is created it discards any variable information.
Is there any way to store these within the child widget?
If not I may have to rework everything to use Data Tables which i’d prefer not to do but if that’s the only way to handle this I have no choice. Code below:
For posterity’s sake, I went ahead and redid this with a Data table / Struct using pretty much the same logic and got the same result. So I guess my only issue is how do I pick up which child button is clicked and pass that Mesh reference to the spawner. Everything else is working as intended.
Ok I managed to get this working!
- Create function in child widget to save the model
- Forward the OnClicked Cal to child widget and spawn logic there
- Destory previous actors and spawn a new one.
Thank you so much @Roy_Wierer.Seda145 for the help it has been greatly apprecitated and insightful. I hope you feel better!
Also used the method from post https://forums.unrealengine.com/t/how-to-have-different-button-clicks-events-per-child-widget/1230864/2 post to get me the spawning to work.
Code Below for everyone else:
You can mark this resolved, thank you again!