Я создаю экземпляр gameObject из prefab и хочу установить локальный масштаб с помощью кода, но когда я устанавливаю transform.localScale для gameObject, он теряет материал и становится черным.
public GameObject ballObject;
public GameObject GetBall(Ball ball)
{
GameObject gameObject = Instantiate(ballObject, ball.position, Quaternion.identity);
gameObject.transform.localScale = ball.scale; // actually, this line destroys the material
gameObject.tag = Constants.ballTag;
return gameObject;
}

