Я не могу изменить положение камеры в моей игре, камера вернулась в исходное положение, я думаю, что-то не так с моим кодом, но я понятия не имею, что его вызывает.
Вот мой код камеры:
private GameObject player;
public float xMin;
public float xMax;
public float yMin;
public float yMax;
// Start is called before the first frame update
void Start()
{
player = GameObject.FindWithTag("player");
}
// Update is called once per frame
void LateUpdate()
{
float x = Mathf.Clamp(player.transform.position.x, xMin, xMax);
float y = Mathf.Clamp(player.transform.position.y, yMin, yMax);
gameObject.transform.position = new Vector3(x, y, gameObject.transform.position.z);
}
}