Creation of an instance of a prefab that depends on variables

Newbie here.

I made a prefab that shows the rules and instructions of my game. Now I want to add language support, I thought the easiest way would be to create other prefabs with the same rules for different languages, so I would have a rules prefab for each language. When the β€œ?” icon is clicked, a static variable containing the language dictates which of the prefabs shoud be instantiated.

How should I do this? So far, the only way I have used prefabs was to drag them into the UI slot for the variable in the script that will instantiate it. Now it should somehow β€œload” it from the resources or somewhere, using its name (which will include the language).

Unity has a localization package available from the Package Mangler… I would recommend starting your investigation there. No sense reinventing all this noise from scratch!

1 Like