Build problem (maybe for a Factory?)

Hi!

We’ve recentlly done a demo version of a FPS, but when we do the build for getting the .exe, the AI isn’t working and does nothing.

The main reason we think it does it is because we’re using a factory pattern for managing the AI, with the corresponding text file, so in the script “Factory.cs” we have this line:
StreamReader f = new StreamReader(“Assets/Behaviour Scripts/Factory/parameters.txt”);
for getting the corresponding class of what we want.

As you can see, we use the route to find the text file in the project folder, and it works good when running the game in the unity editor (and also the first time it runs when we click “Build Run”, but when we close and reopen it, the IA don’t works anymore).

Should we use another route when we do the build? Or copy the parameters file to anywhere when built? Or what other possibilities can we try?

You could place the txt file in the Resources folder and read it as a TextAsset through Resources.Load.

Thanks a lot!!! That worked perfectly!