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

Unable to inherit from ProjectSettings #37384

Open
Shatur opened this issue Mar 28, 2020 · 0 comments
Open

Unable to inherit from ProjectSettings #37384

Shatur opened this issue Mar 28, 2020 · 0 comments

Comments

@Shatur
Copy link
Contributor

Shatur commented Mar 28, 2020

Godot version:
3.2.1

OS/device including version:
Arch Linux

Issue description:
If I trying to extend ProjectSettings I have parsing error:

modules/gdscript/gdscript_compiler.cpp:1864 - Condition "native.is_null()" is true. Returned: ERR_BUG

Extending ProjectSettings can be very useful to add helper methods such as add_gravity() instead of using get_setting("physics/3d/default_gravity") every time.

Steps to reproduce:

  1. Create a script.
  2. Extend it from ProjectSettings.
  3. Add any method or variable.
  4. Try to use it in code.

Minimal reproduction project:
PrjectSettings.zip
In this project I created MySettingsNode class that inherits from Node and works as expected. Also I created MySettingsProjectSettings class that have the same code, but will not work (just try to instantiate it from code to see the error.

Temporary workaround:
For now it is possible to create a class and with static functions and just access to all settings via ProjectsSettings because this is a singleton. This is useful to the error looks like a bug.

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

No branches or pull requests

2 participants