Goal: Player removes rust from a cube (aka “DynamicBP” because it contains a dynamic material), and the amount of rust removed is displayed in a 3D UMG known as “PanelMenu3D” (which is an actor bp that uses “PanelMenu” bp). So far, this works for a regular UMG that is attached to the viewport, but not as a 3D UMG.
DynamicBP (the cube) sets the value (if changed) for the local variable “laserProgress” on tick when the laser is in use. That’s it, no interface is used to pass the variable around, but the variable is public.
PanelMenu has a progress bar binding that casts to the DynamicBP class and gets the variable “laserProgress” to update the progress bar. This works for a regular 2D UMG that is added to viewport.
PanelMenu3D is an actor blueprint that contains PanelMenu as the root, and has manually placed hitboxes for the buttons. This is placed over the monitor static mesh to emulate an interactive computer screen.
Problem: If I cast to DynamicBP from PanelMenu, the editor will crash on compile. See figure below.
Figure 3: The Problem. Editor will crash if I finish the connections and then compile.
Side note: A text box widget that I use as a timer display is cast in a similiar way to my character bp instead of DynamicBP, but this also will cause the same crash if I recreate it in my 3D UMG. Also, I have another UMG running that is attached to my viewport; all the HUD UMG does is appear when a user looks at a button, and then fills up a different progress bar for a second or so.
ENGINE VERSION: 4.6
Since casting causes crashes, is there a workaround for a progress bar binding that gets the progress variable from DynamicBP?
I was unable to reproduce the crash with the information provided. I have a few questions that will help narrow down what issue it is that you are experiencing.
Quick questions:
Can you reproduce this in a clean project?
If so could you provide a detailed list of steps to reproduce this issue on our end?
Could you provide screen shots of the blueprints that are being used?
Have you tried using a scalar parameter?
Example of a scalar parameter:
This is a picture of my 3D widget and a cube that is slowly disappearing. The progress bar shows how transparent the cube is.
Step 1.) Create a new First Person Project (Blueprint).
Step 2.) Open myCharacter blueprint and create a float variable ProgressData and set its default value to 1. Make it public (click the eye).
Step 3.) Create a new widget blueprint (i named it widgetBP). Add a progress bar that is roughly in the middle so it’s easy to see. Compile and save this blueprint.
Step 4.) Create a new actor blueprint (widgetBP_3D), and click add component and select “widget”. Set the widget class to drop menu to widgetBP. Set max interaction distance to 1. Compile and save. Add it to the level so you can see it.
Step 5.) Save all work, next step will cause crash.
Step 6.) Create binding for progress bar in the widgetBP and use picture below, and compile to crash.
I like your example, I didn’t know you could do that. However, in your example you are changing the variable in the widget bp and then the material is collecting it. I need sort of the reverse. I’m trying to get a variable that is changing in an actor bp to update widget bp.