Reload file from FileChooser?

0 favourites
  • 3 posts
From the Asset Store
A sound pack containing 132 laser gun sound effects, including mono and stereo versions of audio files.
  • I'd like to be able to change an external file (.csv) at runtime and load it into my game. I'm able to use FileChooser to do this, works great.

    However, I want to be able to change the same file and reload it multiple times during a game, and would rather not have to use the FileChooser "file picker" dialog every time since the filename/location doesn't change, just the file contents. Is there a way to use the FileChooser "file picker" dialog just for the first file selection/load, and then "reload" the file after it's been modified without having to use the FileChooser "file picker" dialog each time? Hope this makes sense.

    FYI this is just for game dev/debugging purposes, and I don't plan to ship the game with this file loading feature.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You can probably save FileChooser.FileURLAt(0) in a text variable and use it next time you need to reload the same file.

  • Finally getting around to this. After some experimenting, it looks like the FileURLAt(0) string is unique to the version/state of the file at load time, i.e., when you open the file with FileChooser. If the file is then changed, the original FileURLAt(0) string is no longer valid as it's pointing to a file that's no longer there in its original state. After the file was changed, if I try to open the original URL string in the browser, I get:

    Your file couldn’t be accessed: It may have been moved, edited, or deleted.

    ERR_UPLOAD_FILE_CHANGED

    Good idea tho and was worth trying, thanks for the suggestion.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)