using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
[CustomEditor(typeof(AchievementItem))]
public class AchievementItemEditor : Editor
{
private SerializedProperty spriteName;
void OnEnable()
{
spriteName = serializedObject.FindProperty("spriteName");
}
public override void OnInspectorGUI()
{
serializedObject.Update();
DrawDefaultInspector();
NGUIEditorTools.DrawSpriteField("Icon", spriteName.stringValue, NGUISettings.atlas, NGUISettings.selectedSprite, OnSprite, GUILayout.Width(120f));
serializedObject.ApplyModifiedProperties();
}
void OnSprite(string val)
{
serializedObject.Update();
Debug.Log("Called");
spriteName.stringValue = val;
serializedObject.ApplyModifiedProperties();
Repaint();
}
}