#if UNITY_EDITOR
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEditor;
namespace SpriteShadersUltimate
{
[CustomEditor(typeof(SpriteSheetSSU))]
[CanEditMultipleObjects]
public class SpriteSheetSSUEditor : Editor
{
public override void OnInspectorGUI()
{
SerializedProperty updateChanges = serializedObject.FindProperty("updateChanges");
EditorGUILayout.PropertyField(updateChanges);
serializedObject.ApplyModifiedProperties();
GUIStyle labelStyle = new GUIStyle(GUI.skin.label);
labelStyle.richText = true;
EditorGUILayout.Space();
EditorGUILayout.BeginVertical("Helpbox");
GUI.color = new Color(1, 1, 1, 0.7f);
EditorGUILayout.LabelField("Only supports images and sprite renderers.", labelStyle);
EditorGUILayout.LabelField("Requires the Sprite Sheet Fix option enabled.", labelStyle);
EditorGUILayout.LabelField("Sets the material's Sprite Sheet Rect to fix shader issues.", labelStyle);
EditorGUILayout.LabelField("Will also instantiate materials at runtime.", labelStyle);
GUI.color = Color.white;
EditorGUILayout.EndVertical();
//Check:
SpriteSheetSSU targetComponent = (SpriteSheetSSU) target;
if(targetComponent.GetComponent() == null && targetComponent.GetComponent() == null)
{
EditorGUILayout.Space();
GUI.color = Color.red;
EditorGUILayout.BeginVertical("Helpbox");
EditorGUILayout.LabelField("Requires a Sprite Renderer or Image component.", labelStyle);
EditorGUILayout.EndVertical();
GUI.color = Color.white;
}
}
}
}
#endif