Is there a way to change a variable on a 3D Widget in a BP on construct?
We have a system we are building that uses 3d widget in a blueprint. We want to be able to change text in the widget on construct through a variable on the parent blueprint but we cant seem to figure it out. Any ideas? There will be multiple versions of this in a single level too, so I don't think I can just get all actors of class on the widget.
asked Apr 16 '18 at 10:30 PM in Blueprint Scripting
One pattern I've used lately is that I have a User Widget variable on the child widget's class, which I immediately set to the parent widget's reference after constructing the child. Then within the child widget, I can cast to the parent's class and access its variables.
A better pattern is to use Interfaces, so that you don't have to cast, and multiple parent classes can work equally well from the child as long as they all implement the Interface.
But if you don't anticipate more than one or two types of parent widgets being involved with the child's widget class, you can just cast within the child, or vice versa.
answered Apr 17 '18 at 04:16 PM
We were trying to change the variables of a 3D widget on on construct within a BP. After researching several other suggestions, it doesn't look like it can be done anymore. We tried functions and all sorts of different work arounds. We were trying to change the text in a 3d widget so that it would be visible in the editor. We couldnt make it work in BPs.
answered Apr 17 '18 at 09:01 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here