1
Fork 0
mirror of https://github.com/Steffo99/better-tee.git synced 2024-11-26 16:54:17 +00:00
better-tee/Assets/Drawing/Drawable Frame/SetSpriteFromDrawableFrame.cs

18 lines
555 B
C#
Raw Normal View History

2019-09-10 15:01:29 +00:00
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;
}
}