CreatePixelTexture
How do I use Create Pixel Texture
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
File name: PhotonGUI.cs
Copy
69 {
70 get
71 {
72 if( m_DefaultRemoveButtonStyle == null )
73 {
74 m_DefaultRemoveButtonStyle = new GUIStyle();
75 m_DefaultRemoveButtonStyle.fixedWidth = 30;
76 m_DefaultRemoveButtonStyle.fixedHeight = 20;
77 m_DefaultRemoveButtonStyle.active.background = ReorderableListResources.CreatePixelTexture( "Dark Pixel (List GUI)", new Color32( 18, 18, 18, 255 ) );
78 m_DefaultRemoveButtonStyle.imagePosition = ImagePosition.ImageOnly;
79 m_DefaultRemoveButtonStyle.alignment = TextAnchor.MiddleCenter;
80 }
81
82 return m_DefaultRemoveButtonStyle;
83 }
84 }
File name: ReorderableListResources.cs
Copy
130 private static void GenerateSpecialTextures()
131 {
132 var splitterColor = EditorGUIUtility.isProSkin
133 ? new Color( 1f, 1f, 1f, 0.14f )
134 : new Color( 0.59f, 0.59f, 0.59f, 0.55f )
135 ;
136 texItemSplitter = CreatePixelTexture( "(Generated) Item Splitter", splitterColor );
137 }
File name: ReorderableListResources.cs
Copy
147 public static Texture2D CreatePixelTexture( string name, Color color )
148 {
149 var tex = new Texture2D( 1, 1, TextureFormat.ARGB32, false, true );
150 tex.name = name;
151 tex.hideFlags = HideFlags.HideAndDontSave;
152 tex.filterMode = FilterMode.Point;
153 tex.SetPixel( 0, 0, color );
154 tex.Apply();
155 return tex;
156 }
CreatePixelTexture 102 lượt xem
Gõ tìm kiếm nhanh...