SingleLineTexture.cs 671 B

1234567891011121314151617181920212223242526
  1. // Amplify Shader Editor - Visual Shader Editing Tool
  2. // Copyright (c) Amplify Creations, Lda <info@amplify.pt>
  3. using UnityEngine;
  4. using UnityEditor;
  5. using System;
  6. namespace AmplifyShaderEditor
  7. {
  8. public class SingleLineTexture : MaterialPropertyDrawer
  9. {
  10. public override void OnGUI( Rect position, MaterialProperty prop, String label, MaterialEditor editor )
  11. {
  12. EditorGUI.BeginChangeCheck();
  13. EditorGUI.showMixedValue = prop.hasMixedValue;
  14. Texture value = editor.TexturePropertyMiniThumbnail( position, prop, label, string.Empty );
  15. EditorGUI.showMixedValue = false;
  16. if( EditorGUI.EndChangeCheck() )
  17. {
  18. prop.textureValue = value;
  19. }
  20. }
  21. }
  22. }