M
M
Morgenstern Akhmedovich2021-11-01 07:03:45
Unity
Morgenstern Akhmedovich, 2021-11-01 07:03:45

How to change image in Sprite2D?

Hello, I made coins for the game, now I have them at every level. Now I want to change the look of the coin, but I already have a bunch of levels and will have to manually change each coin in each level. My coins are a UI Image with an image. Can I take from the assets the image (file) that I use on the coins and somehow replace it with another one so that the image asset remains in the coins, but already a new one. How can such a trick be done?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nekit Medvedev, 2021-11-01
@NIKROTOS

Prefab the coin first to avoid this in the future. You look on YouTube for a video on the extension of the editor, you delve into it. You write a script in which you look for your coins, read the transform, delete them and put a prefab in their place.
There is an event that is executed when a variable is changed in the editor, I don’t remember the name, maybe you will find something more suitable.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question