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

Custom resources with _init with parameters defined turns into null #71625

Closed
asdfer-1234 opened this issue Jan 18, 2023 · 1 comment
Closed
Labels

Comments

@asdfer-1234
Copy link

Godot version

godot 4.0 beta 13 (caacade)

System information

Windows 10

Issue description

Custom resources with _init defined with parameters turns into null on start
If _init does not have parameters, this issue wont happen

Steps to reproduce

  1. Make a custom resource
  2. Define an _init on the custom resource with parameters on it
  3. Have a Node that stores the custom resource non-null
  4. Run Project

Minimal reproduction project

minimalreproductionproject.zip

@YuriSizov
Copy link
Contributor

If your class doesn't have a parameter-less constructor, then the engine has no idea how to deserialize and initialize it. It doesn't know what to pass to the constructor, and thus it cannot create an instance. Making your arguments optional should work.

See also godotengine/godot-proposals#1513 and godotengine/godot-proposals#5899.

@YuriSizov YuriSizov closed this as not planned Won't fix, can't repro, duplicate, stale Feb 14, 2023
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