I am not sure how to approach this. I have a given gameobject called collectible.go, which always behaves the same way: when the player touches it, it disappears and adds its value to the player’s score. So this collectible.go has a collisionobject, a collectible.script and a sprite. The sprite is my concern.
This collectible can look different and have different values depending on its nature: a coin, a diamond, a gold nugget. Thing is, I can’t just add some Game Object files to the level collection and change their sprite, because… all of them change!
How can I reuse the same game object? Because creating a game object for each collectible, given they behave exactly the same, doesn’t seem too sensible…
The only solution I’ve come up with is setting the sprite and the atlas (and the score value) in the collectible.script as properties, so I can configure them in the editor, and then change their sprite in runtime - it works if I do it in runtime. But that makes level design a bit more cumbersome…