I’m planning to create 2d tool on Unity(which can deform sprite).
It isn’t enough GUI.DrawTexture because i want to create deform feature.
Is there a way to draw Mesh in EditorWindow?
I’m planning to create 2d tool on Unity(which can deform sprite).
It isn’t enough GUI.DrawTexture because i want to create deform feature.
Is there a way to draw Mesh in EditorWindow?
I use Gizmos:
using UnityEngine;
using System.Collections;
[ExecuteInEditMode]
public class DrawMesh : MonoBehaviour {
public Mesh aMesh; // set in Inspector or via script
public Material mat; // set in Inspector or via script
void OnDrawGizmos()
{
mat.SetPass(0);
Graphics.DrawMeshNow(aMesh,
Matrix4x4.TRS(transform.position,transform.rotation,transform.localScale));
}
}
But you could try putting the SetPass and DrawMeshNow in OnGUI, but check that Event.current is Repaint and your position, rotation, scale is up to you.