Set custom material for boxes and templates in GUIs

#1

Hi, is it possible to somehow set custom materials to box/template nodes in defold? i mean, i know i can set custom materials for fonts, but it seems the same is not possible with boxes/templates…
does anyone have any idea of how i can implement two shaders in 1 GUI component? (not counting fonts)~~

PS: i know i can set a material per gui, but that doesnt help me setting shader 1 for box node 1 and shader 2 to box node 2 in my 1 GUI component~~

thanks for the advice! (in advance! :D)

1 Like

#2

I’m afraid there is no way to do this. You would have to use multiple GUI scenes to achieve what you are asking for.

0 Likes

#3

I need it too!!

0 Likes

#4

Maybe there’s an alternative solution in your case? Can you describe what you’re trying to do?

0 Likes

#5

I’m working on a puzzle game.
Each level is built in a tilemap (like in the Colorslide tutorial)
My level selector screen shows a dialog which is made with a GUI box node with a slice 9 texture and some arrow buttons to scroll between levels and a play button (…)
I put all the levels tilemap disposed horizontally in a collection that needs to be shown over the dialog of the GUI :slight_smile:
Using the arrow placed on the dialog I can scroll the camera to show the preview of the level to be played.
Some other GUI elements uses default behavior with the builtin material

To achieve this behavior I’ve …

  • Created a new GUI material cloning the original one, but with a different tag (iug)
  • Changed render script by adding a GUI rendering phase in the beginning (so it is rendered behind the collections) drawing the iug predicate
  • Using two different GUI scenes.

This is pretty easy to do.

The very annoying thing is with scripting… dealing with 2 different gui scenes and scripts, which result in a hassle of messaging between the “standard gui” and the “back gui”

Adding the ability to put a custom material on nodes (or on GUI layers) will solve scripting problems.

0 Likes