Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Using Resources (RESX) files in Unity

Discussion in 'Scripting' started by Deight_8, Mar 17, 2019.

  1. Deight_8

    Deight_8

    Joined:
    Mar 17, 2019
    Posts:
    1
    First of all this is my first time posting to the Unity Forums so if there's anything wrong with the question please let me know. =)
    Now then I was trying to use a resources file or resx file to store my error messages.

    I created the resx file in the Visual Studio Editor using the following method:
    1. Created a new folder in Assets/Scripts called resx
    2. Right Clicked the new folder -> Add -> New Item -> Resources File -> Test.resx
    3. Put in a test value

    But now I'm trying to access the value I receive the following error message:

    Code (CSharp):
    1. MissingManifestResourceException: Could not find any resources appropriate for the specified culture or the neutral culture.  Make sure "Assets.Scripts.resx.test.resources" was correctly embedded or linked into assembly "Assembly-CSharp" at compile time, or that all the satellite assemblies required are loadable and fully signed.
    From what I read online about this error, it seems like the file can't be found by or isn't build yet.

    So in short: What am I doing wrong and how should I use resx files in Unity?
     
    CodePoKE and Menion-Leah like this.
  2. DeveloperGT

    DeveloperGT

    Joined:
    Mar 2, 2020
    Posts:
    6
    Facing similar issue. Were you able to resolve it?
     
  3. kaarloew

    kaarloew

    Joined:
    Nov 1, 2018
    Posts:
    360
    You should not use resx files with Unity. They are XML files that are usually handled with System.Resources namespace.