I've tried to make a coroutine like this
private IEnumerator applyPowerUp(string type, GameObject player)
{
GameObject originPlayer = new GameObject();
originPlayer = player;
if (type == "Bigger")
{
Debug.Log("make it big");
player.transform.localScale = new Vector3(1.25f, 2.9f, 0);
player.transform.position = new Vector2(player.transform.position.x + 0.4f, player.transform.position.y);
yield return new WaitForSeconds(5);
player = originPlayer;
}
}
The game object are getting bigger but after 5 secs it didn't turn back to its origin size.