Hi.
I want to do internationalization for my application and the standard C# way is to use Resource-Files for this (*.resource, *.resx).
I have created a .resx-File using Visual Studio and its “Build Action” is set to “Embedded Resource”.
Whenever I reopen my project in Visual Studio the .resx-File is no longer included in the project.
Also I don’t seem to be able to access any of its contained string values ( MissingManifestResourceException ).
The main problem is, that Unity automatically excludes .resx-Files.
Is there any way to to be able to use such files?
I neither want to roll my own solution for internationalization or use a solution from the asset store, please do not suggest things like that.
I would also be highly interested in finding a solution for this.
We are porting our game to unity and want to keep the existing resx based internationalization…
Unity keeps xml files in the visual studio project, so it should somehow also be possible to include resx (in theory).
Under Editor settings within Unity there are a list of additional file extensions to include when Unity produces the Visual Studio projects. You can add extra file extensions there.
Did this work for you in the end? I’m currently importing an external library and I’d like to have it setup through ASMDef’s - however, even with the added setting so the .resx is picked up in VS/Rider, it still throws MissingManifestResourceException
Edit: Figured it out - the key is to create a native C# class library that contains only the .resx resources and the generate .cs files to accompany them. Then simply import that library as a dependency of the main library that uses the .resx files.
To validate whether the library is correct, check whether it contains the generated CS & resources files, and finally that the string given to ResourceManager inside the generated CS classes does correspond with the .resource files in the DLL. (See attached image as an example)
Hi, I’m not sure whether I can go into much more detail than that? All steps do require at least some knowledge on how to setup projects in C#.
Create a C# Class Library (i.e. a project setup outside of Unity using your IDE of choice)
Move the .resx files and the generated classes into that project.
Ensure that the code in that project loads the resources using the appropriate naming using ResourceManager. (name of the external library (see picture in previous post) and resource file)
Setup that project as a dependency of your main project (most likely by copying the compiled DLL that results from building the previous project, and moving that inside Assets in Unity).