Answer the question
In order to leave comments, you need to log in
Why don't prefab properties change?
Hello. Such a problem: from a script, I change the sprite image of the SpriteRenderer component (like another skin) in a certain prefab, having a link to the SpriteRenderer. And the problem is that when I run the game in unity, everything works, i.e. skin changes. And when I run this in the build (apk file), the skin does not change. Why is that?
The code is elementary, I will give an excerpt:
[SerializeField] SpriteRenderer player; //в инспекторе на это поле я перетаскиваю префаб игрока
[SerializeField] Sprite[] skins; // сюда перетаскиваю картинки игрока (скины)
int i = Random.Range(0, skins.Length);
player.sprite = skins[i]; // так я назначаю скин игроку
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question