In working out an answer to my [last question][1] regarding creating an array of unique GUIStyles from a single GUIStyle I came up with the following code excerpt:
public class sharkTrackRender : MonoBehaviour {
public GUISkin buttonGUISkin;
bool firstpass = true;
void OnGUI () {
if (firstpass) {
for (int i=0; i<pttcnt; i++) {
btnGUIArray *= new GUIStyle(buttonGUISkin.GetStyle(""));*
}
firstpass = false;
}
}
}
This basically does what I want. By setting up a GUISkin from the Project tab Create menu and dropping it in the public GUISkin variable slot in the script’s Inspector I can set up a GUIStyle in the Custom Styles array section of the GUISkin Inspector and use that GUISkin/GUIStyle combination to set up dynamically sized arrays of unique GUIStyles. The problem is in the Inspector I cannot access the Name field of the Custom Styles array elements. The array elements have no default name, and there seems to be no way to give them a name. Clicking on the Name field does not open a text entry box. I found that using the empty string “” in the GetStyle call will access the first element in the Custom Styles array, so, for the moment I can continue coding, but, there appears to be no way to add and use another uniquely named style in the GUISkin Custom Styles array; which at some point I will probably need to do. Adding multiple GUISkins is not an option any more than would be adding multiple GUIStyles, (see my [last question][2]). Any ideas on what I’m missing would be greatly appreciated.
BTW…I’d still be happy hear from anyone on my [sequential quaternion][3] question…;^)
[1]: How do I construct an array of unique GUIStyles from the values in a single GUIStyle when apparently GUIStyles are passed by reference, not value. - Unity Answers
[2]: How do I construct an array of unique GUIStyles from the values in a single GUIStyle when apparently GUIStyles are passed by reference, not value. - Unity Answers
[3]: Why does only the first of sequential quaternion operations work? - Unity Answers