UMG controlling a Blueprint

Ok i am stuck … i have been trying around to get what I want to do working. Your setup is a little more sophisticated than I actually need it.

I know I need exactly three buttons.
Each button triggers one material on a staticMesh- for example a white rough, a blue metallic, and a black shiny material (irrelevant examples) on a cube.

As I see it:

  1. Your PlayerController creates the HUD widget
  2. In the HUD widget is a custom event that creates a button widget and parents it to a vertical box
  3. The Player Controller checks how many boxes are in the scene and repeats the Button creation custom event as often, thereby creating the buttons in the HUD.
  4. Your BP_BoxyBox lets the box meshes rotate at random, creates a random color (via a function) ,an instanced material and assigns a random color to each box
  5. Your BP_BoxyBox has a function called ChangeColor that, depending on if the input parameter reports as pressed it changes the randomly created color to a predetermined color
  6. Your UMG_Button checks wether there are any Boxys in the scene, and gives the buttons the corresponding random colors to the boxes.
    Now it gets interessting:
    7)A OnButtonPressed event triggers the ChangeColor with a pressed State/parameter, thereby changing the color.
    You added a Object reference variable and set it as a target, thereby communicating between the blueprints (i understand that yay :smiley: )
  7. A OnButtonReleased event trigger the ChangeColor with a unpressed state/parameter, thereby changing the color back to random.

Now thank you for this! I understand a great deal more about Blueprint communication now than before!

But I cannot get my thing to work…

  1. I created a PlayerController that creates a HUD and adds it to Viewport. I do not need the dynamic button creation but good to know how it works! I just created a isValid node but did not have anything coming out, or do I? cannot find any decent info about it…
  2. I created a BP_Cube and created this function:
    “Set Material 01 Function”
    <<Set Material >> = Target = the Cube // Material =Material_01
  3. The same thing I did with Material function 02 and 03

To Check wether these functions work, I enabled inputs and put them on keyboard shortcut and that works fine.

  1. I go into my UMG Hud, get the button 01, get my BP_Cube reference, put the function in the event graph and connect the OnPressedEvent into the SetMaterial function and add the BP_Cube reference as a target.

What else could I need to do? Does my function need an input value/parameter?

What just occured to me…
I am creating a mobile game… does on pressed/clicked not work/work differently for mobile?

Thanks alot!