Skip to content

Instantly share code, notes, and snippets.

@chittai
Created December 1, 2018 15:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chittai/ec1a6188d5d9e87c47998d4e8ae406b9 to your computer and use it in GitHub Desktop.
Save chittai/ec1a6188d5d9e87c47998d4e8ae406b9 to your computer and use it in GitHub Desktop.
アセットの使用なし版
public class ChangeUISize : MonoBehaviour {
public GameObject panel;
void Update () {
if (Input.GetKey(KeyCode.Space))
{
StartCoroutine(ChangePaneltoBigSize());
}
}
IEnumerator ChangePaneltoBigSize()
{
var size = 0f;
var speed = 0.05f;
while (size <= 1.0f)
{
panel.transform.localScale = Vector3.Lerp(new Vector3(0, 0, 0), new Vector3(1, 1, 1), size);
size += speed;
yield return null;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment