1
Fork 0
mirror of https://github.com/Steffo99/better-tee.git synced 2024-11-22 23:34:18 +00:00
better-tee/Assets/Drawing/Drawable Frame/SetSpriteFromDrawableFrame.cs
2019-09-10 17:01:29 +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;
}
}