I am learning to refactor and optimize my code, I’ve read using properties instead of an If statement in the Update() function is better design-wise.
Currently this is what the code looks like.
void Update()
{
if (transform.position.y <= -10f)
{
GameManager.Instance.RestartScene();
canMove = false;
}
}
Basically if the player is below -10 on the y axis the scene restarts.
How can I transform this (pun intended) into a property?