How to assign Character to Slot in UMG?
I have created Menu where you can pick a slot and assign character to the slot. I have made working prototype but it was too complex and it seemed that this could be done much more elegant way. I will try to explain the way I went first time.
I spawn BP_character few times, and with foreach loop add random values to the "Info"struct *Info struct posses all the stats of the character, which is updating everytick in BP_character
I make array from spawned characters (of course with delay to let them spawn) Also I store all the variables I will use, here in GM, also different functions and EventDispatcher, which eventually I would call from UMGs to Assign in another UMGs.
I nested few other WB's, such as container with other WB's as Slots, and Side Menu WB with spawned array of WB_Characters which are related to Spawned BP_characters
The Way I did:
1) It will set its index in GM's var as a selected Slot
2) Side menu pops-up on the right with array of WB_Characters (Which are representing spawned BP_characters) Via Event Dispatcher stored in GM. (Not sure
1) it sets its index in GM's var as a selected Character
2) Call in WB_Character an EventDispatcher, so in GM both Index vars of selected Slot and selected WB_char, connects to GM's function "Get Character Info" to get Info
3) Set Info struct to Info struct of selected slot.
This will assign Character to the slot. It works OK-ish, but it feels like so too complex for such simple operation. I has been a week I have tried different approaches, well, they work in my head and in pseudo code, but doesn't in real life.
Make BP_Character set its Info struct to GM's var, as the info in the BP is constantly chaning. And other WB access directly the Var in GM with Info struct rather than the BP_Char. as shown in the picture:
But for some reason I cant Achieve it. Have been trying for a week now.
Also, as an additional challange I want to make assigned WB_Character's button to be disabaled and if I assigned another characted to the same slot it will enable previosly set WB_character's button once more. As if now, after reassignment they are stay still disables, I tried to fix it, maybe it is an easy fix, but seems I am stuck.
Does anyone have any suggestions on how to resolve the problems I faced with?
asked Apr 04 '18 at 01:58 AM in Blueprint Scripting
Follow this question
Once you sign in you will be able to subscribe for any updates here