Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public class AsepriteImporter : ScriptedImporter, IAseVisitor
// Editor fields
public float m_PixelsPerUnit = 100.0f;
public SpriteAtlas m_SpriteAtlas;
public Material m_SpriteMaterial;
public float m_FrameRate = 60.0f;
public string m_SortingLayerName;
public int m_SortingOrder;
Expand Down Expand Up @@ -95,6 +96,11 @@ public void EndFileVisit(AseFile file)

var renderer = m_GameObject.AddComponent<SpriteRenderer>();
renderer.sprite = m_Sprites[0];
if (m_SpriteMaterial != null)
{
renderer.material = m_SpriteMaterial;
}

renderer.sortingLayerName = m_SortingLayerName;
renderer.sortingOrder = m_SortingOrder;

Expand Down Expand Up @@ -421,7 +427,7 @@ private void MakeAnimationClip(string name, bool isLooping, List<int> frameIndic
var key = new ObjectReferenceKeyframe();
key.time = time;
key.value = m_Sprites[frameIndex];
time += m_Frames[frameIndex].FrameDurationMs / 1000.0f;
time += (m_Frames[frameIndex].FrameDurationMs / 1000.0f) * (60f / clip.frameRate);

keys[i] = key;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ public override void OnInspectorGUI()
EditorGUILayout.PropertyField(serializedObject.FindProperty("m_SpriteAtlas"),
new GUIContent("Sprite Atlas", "The sprites created by this import will be made part of this sprite atlas."));

EditorGUILayout.PropertyField(serializedObject.FindProperty("m_SpriteMaterial"),
new GUIContent("Sprite Material", "Material for the SpriteRenderer."));

DisplayStringChoiceProperty(serializedObject.FindProperty("m_SortingLayerName"),
SortingLayer.layers.Select(l => l.name).ToArray(),
new GUIContent("Sorting Layer", "Name of the SpriteRenderer's sorting layer."));
Expand Down