Allow me to prefix this with an apology, I know, I can hear the collective sigh at this question.
At saying that i have google the living hell out of this question and can’t find the answer, I’ve been stuck on it for over a week and can’t figure it out, I asked on the AnswerHub but got no answers. I’m probably missing some incredibly basic functionality here, so again, sorry.
That said:
I’m simply trying to get a variable (Integer) from BP_Inventory (which i made as an actor type) into a widget (WID_Inventory). I’ve found a number of guides showing me how to do it but they all use the player controller as the reference object for the “Cast to” node. I don’t want to include the Inventory inside the BP_MyPlayerCharacter apart from anything else, because there is enough going in there already.
What i’m TRYING to do, get the max bag slots from BP_Inventory, then in the widget, multiply that by 75 and change a size boxes Height override based on that number.
If possible i would rather use V2 as this doesn’t require the “Get All Actors Of Class” node, which I’m told is resource hungry.
Just to clarify here and answer what questions i can before they’re asked. If I’m teaching you to suck eggs with this, i apologize, I’m not sure what is obvious to an external viewer and what isn’t.
The WID_Inventory is then placed/referenced inside another widget called WID_Interface. which is what is being created and printed to screen in the BP_MyPlayerCharacter
V1 and V2 are the two methods i have attempted. One at a time, not both at once
In V2 I created a variable of type BP_Inventory reference.
The numbers i have written in red next to the get BagSlotX variables and the SetBagSlotMax variable are the defaults. So they should be returning a value of 200 as the custom event “MaxBagSlots” isn’t being called yet.
Using V1 i get my cast failed text back
Using V2 i get the error “PIE:Error: Error Blueprint Runtime Error: Accessed None trying to read property BP_InventoryRef from function: ‘ExecuteUbergraph_WID_Inventory’ from node: Set Height Override in graph: EventGraph”
Thanks in advance for any help.