Search Unity

  1. All Pro and Enterprise subscribers: find helpful & inspiring creative, tech, and business know-how in the new Unity Success Hub. Sign in to stay up to date.
    Dismiss Notice
  2. Dismiss Notice

Resources folder

Discussion in 'Editor & General Support' started by Bluestrike, Aug 15, 2014.

  1. Bluestrike

    Bluestrike

    Joined:
    Sep 26, 2009
    Posts:
    256
    How does it work? Resources added to the resources folder are included when building the game.
    But my .txt files do not show up in the resources folder when I build the game.
    Did they get encrypted/packed?

    How do I prevent the cypting/packaging, or is there another way to add extra files to the game during the build process?

    I have a mapcycle.txt file that I want players to be able to modify out of the game.
    I would also be able to sync it to the cloud and can't do that when its packed.
     
    Last edited: Aug 15, 2014
  2. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    Everything that is bundled by Unity should stay untouched. Otherwise you may end up in a huge disaster.

    What is the target platform?
     
  3. Bluestrike

    Bluestrike

    Joined:
    Sep 26, 2009
    Posts:
    256
    pc/Linux/osx

    I have the txt load as an external resource.
    • var sMapCycleTXT : String = Application.dataPath + "/mapcycle.txt";

    I got tired of copy pasting it to the game folder after building the game ( or forget to do it ), so I was looking for an automated way of doing this and tought adding it to the resources folder would do the trick.
    • var sMapCycleTXT : String = Application.dataPath + "/Resources/mapcycle.txt";
     
  4. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    How about changing the logic as follows:
    - Check whether Application.dataPath + "/mapcycle.txt" exists
    -> If not, load the default one (doesn't necessarily need to be in the resource folder)
    -> Otherwise, use it


    - Save changes to Application.dataPath + "/mapcycle.txt"
     
  5. Bluestrike

    Bluestrike

    Joined:
    Sep 26, 2009
    Posts:
    256
    That should work.
     
  6. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,300
    Yes, everything in the Resources folder is bundled into a file. The Resources folder does not exist as such in a build.

    --Eric
     
unityunity