0 votes

In my game, I build a list of levels from files inside the res://levels/ directory.
It works fine when testing in the editor, but once exported my code returns zero files :O
It is caused by my code filtering out files that are not .tscn. In exported games, they are converted to .scn, so I get no files.
Also, in some places I need to append .tscn to parameters, but in the exported version it changes to .scn, then doesn't works...

how do I know that I'm in an exported version?

in Engine by (29,090 points)
edited by

1 Answer

0 votes

Kind of a work-around but if you export only release you could check for debug vs release in your code.

Also you didn't say what you export to, but if it's to mobile then you can also check for the platform/OS name.

by (728 points)

I'm exporting for Windows and Android, but the target doesn't matters, I just need to know if assets got exported or not.
I can only find partial workarounds at the moment, but all they do is partially work and mess with my codebase :s

Wouldn't debug/release work though?

Ok apparently loading .tscn works thanks to resource remaps, but iterating the directory still gives no results, unless I match both .tscn and .scn. That workaround should do the trick better than debug/release :)

ok good. I guess you've come across the various issues with file/directory functions under Android.

So if you had an is_exported() function, that still wouldn't have solved it for you?

It would had solved in a way I could know which extension to deal with. But taking it on a higher level, file encodings and extensions shouldn't actually matter when dealing with the problem of "get this scene having this name" or "get scenes in that folder".

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.