- Home /
How do I load images after building?
So I want users of my game to be able to "mod" there own jump scare image into the game. These players will not be able to access the pre-built game so need an after build solution. I code in Javascript.
Answer by Freaking-Pingo · Nov 03, 2013 at 10:48 PM
I don't have much experience with Javascript and therefore I can't aid you much on that part, but I recently created my own script capable of reading .wav files from an external folder using System.IO. I presume you can modify this to fit yours, but as stated this is written in C#.
The example code work as follows: First it check whether the folder "SoundFolder" exist, if it doesn't it simply creates a new one. This folder is located in the same folder as the build. I then get a list of all files wihtin that folder and filter all other files. that doesn't have the .wav extension to it. I am not even sure whether this would work on Mac.
public void Initialize()
{
DirectoryInfo directoryInformation = new DirectoryInfo("SoundFolder");
if(!directoryInformation.Exists)
directoryInformation.Create();
FileInfo[] fileList = directoryInformation.GetFiles();
foreach (FileInfo file in fileList)
{
if (file.Extension == ".wav")
{
SomeCode();
}
}
}