Swapping out brush textures using a string

I have been searching all night for a solution to this. Hopefully someone can help me?

I have this String that calculates the day of the week based on my machine.

I have these 7 textures/images that I made to correspond with the days of the week.
3

I would like to use the String I made to swap to the correct texture that corresponds with
the day of the week. For anyone interested I am trying to replicate the clock from
Animal Crossing New Horizon’s as my first UI project.

I’m happy to say that this is the final logic I need to build before I create the Fade in and Fade out animation. Any help with this would be amazing. Thank you in advance.

Sounds just like this:

You could add it to the script you have since you have the correct integer already.


If you need to use a dedicated function binding for this:

  • create a new Slate Brush variable, you can configure it or leave it as is:

  • in the details panels of the image (assuming) create a new binding:

image

  • in the function binding:

1 Like

And if you really must use a string:

But try to avoid it.

1 Like

This worked! I spend several hours last night trying to make the string work when I could have just plugged all that in with an Int. You’re a god! thank you!

For anyone wondering: Look at the logic I made to determine the day of the week and delete the “Select” node with the “string” pins and the String “Return” node. I ended up moving the logic in to my main “UpdateRealTime” Function. instead of making it it’s own function. Here is what it looks like now.

Now this logic can be used with any clock to show the day of the week using texture assets instead of text. But if you wanted text than you’d use the previous string method with a “Text” Element instead.

One minor note for anyone reading this who is having the same issue!
I made the “Select” node first and changed the pins to “Texture” but they would not connect to the “Set Brush from Texture’s” Texture pin. I had to begin my search for the correct “Select” node by first beginning my connect from the Texture pin on the “Set brush from Texture” Node. When you click on the “Select” Node option in the search it will automatically create the correct pins for the “Set Brush from Texture” Node.

Thank you again Everynone!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.