GUILayout Icon + Text

Hello Everybody

I Have a GUILayout.label(“WhatEver”);
i just need add Icon To This Label

i followed this Link

link text

But the Problem That its need 2 Label
Is there way to make it in 1 Label? and Thanks

You can either define a GUIStyle from within the code

(Unity - Scripting API: GUIStyle)

Or define the ‘Label’ guistyle in a new GUISkin

This way you could define a background image for the label, and offset the text if needed.

I got the same problem, here my solution, hope it help other people.

public Texture2D icon;

void OnGUI () {
     GUI.Box (new Rect (10,10,100,50), new GUIContent("This is text", icon));
}

This generates single label that looks at the player. Image is on the left of the text.

private void OnDrawGizmos(){
	GUIContent gUIContent = new GUIContent( "text", 				
 	EditorGUIUtility.FindTexture( "Animation.Record" ) );
	Handles.Label( this.transform.position, gUIContent );
}