Get Construct to use Relative Paths in Files

0 favourites
  • 4 posts
From the Asset Store
Casino? money? who knows? but the target is the same!
  • I use a CSS file (buttons.en-us.css) to customize my buttons and set them via the background property. In order for Construct preview to work properly I have to use an absolute path:

    background: url('assets/img/tutorial/TutorialBGIdle.png') no-repeat;
    

    But for other hosting sites when I publish the game (Scorm in my case), I have to use a relative path:

    background: url('../../img/tutorial/TutorialBGIdle.png') no-repeat;
    

    I can probably workaround this if I change my export structure to Flat instead of Folders, but since that's not recommend I wanted to see if anyone else has figured this out.

  • Preview should work the same as export. It was specifically designed like that to avoid differences between preview and export. If it doesn't, please file an issue.

    In your case it looks like you are using relative paths in both cases, but after export the server or upload process actually changes the folder structure. There's nothing much Construct can do about that: it expects export to work the same way as preview. So the best approach is to make sure the publishing system preserves the same folder structure.

  • This seems to have been fixed in one of the latest version of Construct. The first line of CSS I posted no longer works. While the second works just fine now. (which is what I wanted).

    I am curious to know which release addressed and fixed this issue so that I can inform my team

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • We have not made any intentional changes to how this works for several months now. I suspect it was not really a Construct update that changed. However if you really want to look, you can always check past releases yourself.

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