easy way of relinking 2D sprites to different files?

Hi, Im wondering if anybody could help…

Ive got a whole screen of buttons (a computer keyboards worth), each button is a 2d unity sprite, i want to create 3 versions at different graphic sizes. What id like to be able to do is automatically/easily link all the buttons to graphics in a different folder (all the files are named identically in each folder)

eg.

2k/button1.png relinks to… 4k/button1.png etc. etc.

Its basically a time saving thing, as relinking all the buttons for 1,2 4k will take quite some time

any help would be much appreciated!

thanks

Nick

If you are using git/svn you can try this:

-Load 2k.scene
-In Finder overwrite all 2k files by 4K files
-Task switch to Unity and now the 2k scene should have 4k sprites
-In the Unity Project tab (not in finder) rename your 2k folder to 4k (as it now contains 4k files)
-save the scene as 4k.scene
-in git, revert the changes to the 2k scenes and files, but commit all the 4K ones

There can be different solutions for this scenario, for example:

Create a data type (deriving from ScriptableObject) that will contain a set of texture references (one texture per keyboard key). ScriptableObjects can be used as “data containers” and are also nice since you can store them as an asset in your project.

Once you have that data type, you can create different assets from it, each one pointing to different textures.
At runtime, you would assign the needed asset to your game object to get the corresponding textures from.