Game does not load external files

Hi
I have a problem loading external game files in webgl. in the windows version everything works without any problems. Do web games use different file pointing? The game loads external files required for operation and the browser version will not run at all. Maybe someone can advise what may be wrong.

I want to run this project in the browser: GitHub - slavidodo/OpenTibia-Unity: A collection of projects to boost OpenTibia development!

Web applications are prohibited from using the file system API. If that “external file” is in a location like the user’s home directory, the app cannot access that. You will have to make those files available via a webserver / webservice or cloud drive, or bundle them within the app itself by using the StreamingAssets folder.

1 Like

thank you for the information. I tried to share these files on my server where the game is hosted, but these files still cannot be loaded. gives an absolute address with https and a relative one and it doesn’t work. see the files are visible here: https://zanera.pl/client/StreamingAssets/860/
but the unity game doesn’t see them. how to specify the path to these files? I’ve tried every method.

How are you trying to load them?

        protected void LoadProtoAppearanaces(string assetsPath) {
            string appearancesPath = Path.Combine(assetsPath, "appearances.otud");
            if (!File.Exists(appearancesPath))
                throw new FileNotFoundException(string.Format("Couldn't find the appearances ({0}).", appearancesPath));
          
            try {
                byte[] bytes = File.ReadAllBytes(appearancesPath);
                AppearanceStorage.SetProtoAppearances(Protobuf.Appearances.Appearances.Parser.ParseFrom(bytes));
            } catch (System.Exception e) {
                throw new System.Exception(string.Format("Unable to appearances.otud ({0}).", e.Message));
            }
        }
        public string GetAssetsPath(int clientVersion, int buildVersion, ClientSpecification specification) {
            string assetsPath;
            if (clientVersion >= 1100)
                assetsPath = string.Format("{0}.{1}", clientVersion, buildVersion);
            else
                assetsPath = clientVersion.ToString();

            assetsPath = Path.Combine(Application.streamingAssetsPath, assetsPath);
            return assetsPath;
        }

so im guessing something goes wrong in your GetAssetsPath, where your assetsPath is clientversion.buildV|ersion - wheres the . in your path? is it because its expecting to find some form of subfolder?