Download

Problem with linking static mesh as reference in UMG.

As said in the title, i’m currently having trouble with linking a static mesh into the UMG blueprint. What i’m trying to achieve is to make a color selection menu for the object and to change it’s color.

I have no problem creating the menu and everything seems to be working fine until i tried to define the object that the color change is applied to.

Here’s my blueprints :

1f8b5ad2f36f39d591187b11a38a9a1bfb9f317a.jpeg

As seen in this widget blueprint, when i tried to compile it, an error occurred and i have no idea why. When i click on the static mesh component in the compiler results, it successfully links to the static mesh in the game.

d44a8ebc93ad6d6dfc1e6c77244018a572ec426f.jpeg

This is the widget blueprint for the menu. This is working fine without any problems.

9256774185d672c23cb9119ed6bfd8a879d16919.jpeg

This is the blueprint for the particular static mesh itself. This is for detection of a key event when near the object. Once i click on a button, the menu will appear. There are no problems with this either.

ea61d905610f410b0b2c42139fca2df92478cd65.jpeg

This is how it appear in the game.

As seen through all the printscreens, the problem lies on the first 1 printscreen where i can’t set the object to be defined as the object the color change is applied to. How do i fix this?

Thanks in advance.

Hello,
I suppose that the trouble comes from your reference. You need to set it once you have created your widget (drag a “set staticmesh component” from return value of create widget and set it with the component in blueprint.)

Thanks for the reply. I have tried what you have suggested and change my blueprint correspondingly. After i did that, no error occured but the material of my static mesh did not change. What am i doing wrong?

bcee5701ebef15a4fe636fc703608844926c1ac4.jpeg
UMG1.jpg

The variable color box, in your widget is a generic reference to your type of blueprint, not a specific one. You need to “set” it. To do that, from the "return value of your “create widget” drag a “set color box” and set it with a “self”.

It’s finally working!! TQ SO MUCH!!!

You are welcome ^^