1
Fork 0
mirror of https://github.com/Steffo99/better-tee.git synced 2024-11-26 08:44:19 +00:00
better-tee/Assets/Drawing/Scripts/SetSpriteFromDrawableFrame.cs
2019-09-11 15:13:31 +02:00

17 lines
555 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SetSpriteFromDrawableFrame : MonoBehaviour
{
protected DrawableFrame frame;
protected SpriteRenderer spriteRenderer;
void Start()
{
frame = GetComponent<DrawableFrame>();
spriteRenderer = GetComponent<SpriteRenderer>();
Sprite sprite = Sprite.Create(frame.texture, new Rect(0, 0, frame.resolution.x, frame.resolution.y), new Vector2(0.5f, 0.5f), frame.resolution.x);
spriteRenderer.sprite = sprite;
}
}