Loading external resource files – by manually storing files in the Unity Resources folder
At times, the contents of the external resource files may need to be changed after the game compilation. Hosting the resource files on the web may not be an option. There is a method of manually storing and reading files from the Resources
folder of the compiled game, which allows for those files to be changed after the game compilation.
Note
This technique only works when you compile to a Windows or Mac stand alone executable—it will not work for Web Player builds, for example.
Getting ready
The 1362_10_01
folder provides the texture image that you can use for this recipe:
externalTexture.jpg
How to do it...
To load external resources by manually storing the files in the Resources
folder, do the following:
In a 2D project, create a new Image UI GameObject.
Add the following C# script class as a component of your Image object:
using UnityEngine; using System.Collections; using UnityEngine.UI; using System...