Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot export library to Android platform #56

Open
Destarianon opened this issue Apr 8, 2020 · 6 comments
Open

Cannot export library to Android platform #56

Destarianon opened this issue Apr 8, 2020 · 6 comments
Labels

Comments

@Destarianon
Copy link

When using the libraries, all exports to the Android platform fail with the error:
SCRIPT ERROR: Parse Error: The identifier "EditorInspectorPlugin" isn't a valid type (not a script or class), or couldn't be found on base "self".

@willnationsdev
Copy link
Member

Hmm. EditorInspectorPlugin is a type that should only be used in the editor context, not in an exported game...

I think this is probably happening because we have type hints that reference the EditorInspectorPlugin class name in a few of our classes like ResourceCollection. If you have it in your project anywhere (regardless of whether you are using it), then it will trigger an error with a fully exported game since the EditorInspectorPlugin class doesn't exist in release builds of the engine.

@willnationsdev
Copy link
Member

willnationsdev commented Apr 8, 2020

@Destarianon Can you pull from the latest master (or just change the type hints in CallbackDelegator and ResourceCollection to use Reference instead of EditorInspectorPlugin) and then see if the issue is resolved?

Edit: For reference, the commit is 795c60f.

@Destarianon
Copy link
Author

Pulled the latest master and that did not resolve the issue.

These are debug builds being sent via one-click deployment. From a logcat of running this on a physical device it appears that it's failing to load the following files in order:

  • class_type.gdc
  • resource_collection.gdc
  • resource_set.gdc

Once those files have failed to load it causes the default scene to fail to load and the app just cycles to try again. The error in OP is always the first script error to appear in the logs.

The issue does not occur unless a CallbackDelegator node has been included in the project.

@willnationsdev
Copy link
Member

willnationsdev commented Apr 8, 2020

Not sure if this is it, but...

ResourceCollection, which ResourceSet extends, and CallbackDelegator both create an instance of ClassType. ClassType's null constructor has a flag to generate a "deep type map" which was this magical nonsense I wrote a long time ago to be able to load scripts by name based on transformations to their filename, e.g. "my_class.gd" could be accessed with "MyClass". That feature predates the script class system though and honestly is too magical to be kept in there.

I think the fix will be to remove the deep type map functionality entirely since generating it involves going out and messing with scripts all over the project folder (even ones which may only be purposeful towards tool work in the editor context, hence the error, probably). I haven't used it in an exported project which is probably why no one has noticed it before.

@willnationsdev
Copy link
Member

I'll try to work on the fix in the newly made fix-callback-delegator-export branch on my fork. Once we're confident we have it fixed, we can merge it into the main repo.

In the meantime, you could try just changing the null constructor's default value to set the p_generate_deep_map equal to false instead. See if that fixes it by stopping it from going out and accessing other script data.

@Destarianon
Copy link
Author

Disabling the "deep type map" default in the null constructor of ClassType did not resolve the issue.

At the moment, I will need to disable the library as my code has to run against an android device to test mobile specific functionality. If I need to further test changes against an Android device let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants