How to add a variable to a texture?

Hello everyone :slight_smile:

I want there to be a sign in a city that says “Welcome To (City Name)!” I want the player the be able to change the name of the city. How can I make it so that the sign says the city name that the player picks?

Thanks!

I just made an actor with the sign as a static mesh, then added a text render component which can be changed with a set text node.

I’m not set on doing it any particular way. If it works, it works haha

I just need it to be able to work over a texture I already do have made

Do you absolutely need to do it in a material? Or are you happy to accept an alternative?

I’m not set on doing it any particular
way. If it works, it works haha I just
need it to be able to work over a
texture I already do have made

The above would work OK.

If you need to dynamically type in the text, while you’re in the game, an alternative here would be a widget component with editable text.

How can I make it so that the sign
says the city name that the player
picks?

Is this chosen before the game starts or during gameplay? And if so, how does it work, we approach the sign, click on it and type in a new name? Or?

  • You could set the parameter of a
    material instance (MID< Material Instance Dynamic)

as documented MaterialInstances

And how would you turn it into text?

Depends on how much control you need, If you want a player to choose between a few styled textures (names) then you can use the chosen texture as an input for the material instance. Another way of doing it is adding a TextRenderComponent like Cross3905 suggests or even a WidgetComponent to render UMG stuff in 3D space

This works perfect! Thank you :smiley:

The player would start in a pre-made city and would then get to create the custom city (while in the pre-made city) where they would pick the name and various other things in a city customization type menu. The sign would be in the custom city which would be in a different level.