I have a ScriptableObject that simply have a list of object:
class MyClassHolder : ScriptableObject
{
public MyClass[] myClass;
}
[System.Serializable]
public class MyClass
{
public string key;
public int priority;
public Data data;
}
And some class for datas:
[System.Serializable]
public class Data
{
public Icon icon;
public Color color;
}
[System.Serializable]
public class Icon
{
public TextureSet[] small;
public TextureSet[] big;
}
[System.Serializable]
public class TextureSet
{
public Texture2D texture;
public Vector2 offset;
[Range(0f, 1.2f)]
public float scale = 1;
}
Which now looking like this:

I have the code for drawing the icon which just like:

What i want to try to do is add a preview beside of the "Small" and "Big", like this if can:

Or under the Data like this:

I know there are CustomEditor or some Drawer but no idea which is suite for the case.
And Which class should i working with?
Update: I end up having this, looking good enter image description here
For this use case I wouldn't use a CustomEditor, which is for implementing a custom Inspector for an entire
ScriptableObjectorMonoBehaviour. This would be a lot of overhead just to customize the way a certain field is drawn. Additionally you would have to do it for each and every other class where you use this field type.You rather want a custom
PropertyDrawer, which is used to implement a custom way for drawing only the field of a specific type - in your case for theTextureSet.Could look somewhat like e.g.
I hope this is a good starting point, you will probably have to play around a bit and figure out how exactly you want to apply the
scaleandoffsetto the preview according to your needs.Little demo