I am trying to do something in unity, And I need to know if the camera is moving or not.
This is the script:
GameObject MainCamara = GameObject.FindGameObjectWithTag("MainCamera");
NewPosition = new Vector3(player.position.x, player.position.y, -10);
positionChanging(NewPosition);
if (MainCamara.GetComponent<Rigidbody2D>() == null)
{
CameraMoving = true;
}
if (MainCamara.GetComponent<Rigidbody2D>().velocity.magnitude > 0.01f)
{
CameraMoving = true;
}
CameraMoving = false;
I am not getting any errors, but it still doesn't work