I am working on Unity, and I what I would like to do is to make a model rise from below through a coroutine. The code is the following:
using System.Collections;
using UnityEngine;
public class CharacterVisualization : MonoBehaviour
{
public IEnumerator UpRising(float finalY, float riseVelocity)
{
var position = transform.localPosition;
while (position.y < finalY)
{
position = new Vector3(position.x, position.y + riseVelocity,
position.z);
transform.position = position;
yield return new WaitForSeconds(0.1f);
}
}
}
The problem is that I have not coherent y values in the editor and in the console (while printing), as shown in the following two images:
Printed position inside the Unity console
Transform position and rotation inside the Unity editor
I tried using both position and localPosition, without having success. Could someone help me please?

