- Home /
Prefab change before instatiation not updating until opening in prefab mode
Trying to change the sprite of my ground prefab when switching to another game level. Little confused how prefabs work though.
Can I switch a prefab's sprite mid-game to have all new spawned instances of that prefab, after the sprite switch, have that new sprite texture?
I've tried setting the prefab texture manually using:
[SerializeField] private GameObject groundPrefab;
[SerializeField] private Sprite tileSprite;
and:
groundPrefab.GetComponent().sprite = tileSprite;
Here's the problem though: The change only applies to the prefab once I've opened the ground prefab in prefab mode, thus updating it! The prefabs spawns in with the previous texture until I open the prefab in prefab mode, then prefabs with the new assigned texture is instantiated.
Don't know if this is intended but at this point I just want to know, is changing a prefab before instantiation possible?
Your answer
Follow this Question
Related Questions
Prefabs spawn with wrong values 0 Answers
How can I save and load a prefab? 0 Answers
Object spawns itself instead of it's prefab. 3 Answers
How to edit prefab instances at Runtime/Creation Time 1 Answer
Prefabs won't change? 1 Answer