Creating a GUI.Toolbar with Custom GUIStyle

Hello, I was wondering if it was possible to create a toolbar with 5 buttons each button having a unique mouse over, pressed and not pressed texture. I tried to do this with the following code but after much tinkering it still is not working.

category = GUI.Toolbar(new Rect(5, 5, SHOP_WIDTH - 10, 85), category, categoryName, categoryButtons);

Where category is an int. categoryName is a list of strings. categoryButtons is a list of GUIStyles.

categoryButtons = new GUIStyle[] { mySkin.FindStyle("TB1Button"), mySkin.FindStyle("TB2Button"), mySkin.FindStyle("TB3Button"), mySkin.FindStyle("TB4Button") };

Any ideas?

Thanks Hans

According to the docs GUI.Toolbar doesn't take an array of GUIStyles, so you only can provide one. I think you have two options:

  1. Try how it looks when you feed GUI.Toolbar with an array of GUIContent that hold your images
  2. Create your own toolbar: Draw each button on it's own, so you have full control over it's appearance

Jake

@HHameline : sorry to interrupt, does your problem solved? I also have the same problem…But I’ve already got each button unique style, how do I implement it into the toolbar scripts? Thx

I've got no idea