mirror of
https://github.com/RaindropViewer/RaindropViewer.git
synced 2026-07-28 15:32:16 +00:00
26 lines
574 B
C#
26 lines
574 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class SpriteSizeManager : MonoBehaviour
|
|
{
|
|
public SpriteRenderer sprite;
|
|
public float targetHeight = 0.5f;
|
|
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
sprite = this.GetComponent<SpriteRenderer>();
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
var bounds = sprite.sprite.bounds;
|
|
var factor = targetHeight / bounds.size.y;
|
|
transform.localScale = new Vector3(factor, factor, factor);
|
|
|
|
|
|
}
|
|
}
|