why is this cast between 2 user widget not working

So i do not fully understand casting yet, but every tutorial is telling me that the wildcard needs to be the parent class or the player controller. which are both not options that work here. I think it has to do with being user widgets and not actors.

User widget variable probably need to be a direct reference to the Widget rather than a object reference, but if i have a direct reference in the user widget i wouldn’t need the cast anyway right?

this is the array i am trying to acces.

so pretty much 2 questions

  1. How do you cast between 2 user widget (if even nessesary)
  2. Is there a better way of accesing the User Widget Array then casting.

When and how is the “User Widget” variable set (img 1)?

If that variable isn’t valid (aka empty) the cast will fail.

yes i figuered that and it is not set but how do i set that user widget to be the correct one

Whenever you create a widget you should be storing the return value as obj type.

In the widget class that has the ref dependency you should create a variable matching type.

When you create the dependent widget (CaravanSoldierSelect) directly set the var.


Now there’s no need to cast. Just drag the var ref in to the graph and access its vars.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.