Can you please help? With the help of @L1z4rD89 I made a Widget that picks 5 random words to make a full Name of a weapon. Now I want to use that a word in the Name, e.g. “Slicey” or “Hammer” to drive which Static Mesh the weapon gets.
But Set Static Mesh node, with the Static Mesh component connected as Target, and a Static Mesh variable connected as the new Static Mesh = Static Mesh turns invisible in game.
I used a Data Table with a Weapon Name (String), and exact Mesh Name (of a Static Mesh in UE).
I have code in my Widget, that randomly chooses a row from my Weapon Data table = to pick it’s Name (String), and Static Mesh (goal).
.
.
On BeginPlay, my Sword Actor BP is already in the Level, and its existence triggers the random code which is already working to set the Name display on my Widget > which (the Widget) is a component in Sword Actor BP.
So this Sword Actor BP has this Widget and a temporary sword Static Mesh “component.” In that BP, I cast to the Widget, to get the value of its Random row number, which decides the Static Mesh Name, which I want to replace as the current “Static Mesh component.”
The problems:
-
When I load the game, Event Begin Play fires: The Widget code works to give the Sword BP its name; but every Sword Actor BP has an invisible Static mesh (some are already placed in the level, some are spawned from a touching a trigger > also invisible. But the random Weapon name shows – so I know the Widget-to-BP communication is working).
-
I know that they are being assigned the “Static mesh” name, because I print the name of the Static mesh (which got pulled from the random Widget selection code).
-
But the mesh is invisible??
-
Problem 2: Technically the Sword Actor BP uses “Static Mesh component” not “Static Mesh.” But the Set Static Mesh node expects an input of “Static Mesh.”
-
And In my Struck (that uses the Data Table), I cant set the Static Mesh variable to “Static Mesh Component,” or else the Static Mesh name in the Data Table (loaded from CSV file), disappears on its own.
-
[I did try to change my Struct variable to “Static Mesh Component,” then change the variable in the Widget to “Static Mesh Component” > which sends to the Sword Actor BP. But the mesh was still invisible (or did not send because the Data Table erases the Static Mesh name when I choose “Static Mesh Component.”]
-
So what is the problem???
-
Also I cant put the random-selection code in the Sword Actor BP (or dont know how), because I need to access Variables in the Widget BP [UMG code] (which seems harder to go to, vs Widget > to BP code).
-
But ultimately I want a full Data Struct that changes 5 variables of the Weapon BP (e.g. emitters, color, mesh). While I only need to change 2 text labels in the Widget UMG.
-
I also tried to communicate between them with BPI (Blueprint Interface). But it failed to send Widget info to Sword Actor BP.