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

[.Net] All Script Exports Becomes Null and Ineditable #98124

Open
Delsin-Yu opened this issue Oct 12, 2024 · 4 comments · May be fixed by #98153
Open

[.Net] All Script Exports Becomes Null and Ineditable #98124

Delsin-Yu opened this issue Oct 12, 2024 · 4 comments · May be fixed by #98153

Comments

@Delsin-Yu
Copy link
Contributor

Tested versions

v4.3.stable.mono.official [77dcf97]

System information

v4.3.stable.mono.official [77dcf97]

Issue description

Under certain unknown conditions, every C# script's export will become null and ineditable.

Steps to reproduce

  1. Download the MRP
  2. Unzip the MRP and Open it with Godot 4.3 Stable Mono
  3. Without opening any Scene, Build the C# Project
  4. Open the Scenes/Main.tscn
  5. Ignore the missing dependency error; this MRP is an existing game project with proprietary art assets stripped out.
  6. Inspect the issue; every script export has turned into null, and reassigning doesn't work.
QQ20241013-379.mp4

Minimal reproduction project (MRP)

MRP_ObjectsBecomeNull.zip

@Delsin-Yu
Copy link
Contributor Author

Related

@Delsin-Yu
Copy link
Contributor Author

A diff for Main.tscn before and after saving to file.

image

@raulsntos
Copy link
Member

You have this in your AkisFarm.csproj:

<DefineConstants>EnableProfiling</DefineConstants>

This is replacing all the define constants, including the ones defined by Godot (see docs for the full list).

Specifically, the TOOLS define constant is important because some special functions used by Godot to retrieve information about your C# classes are only included when TOOLS is defined.

What you want is:

<DefineConstants>$(DefineConstants);EnableProfiling</DefineConstants>

This way you are appending to the existing list of define constants.

@Delsin-Yu
Copy link
Contributor Author

<DefineConstants>$(DefineConstants);EnableProfiling</DefineConstants>

@raulsntos
Thanks! This resolves the issue. I plan to create a PR for GodotSharp to alert C# users of this use case, as it may not produce an obvious error, potentially confusing the user.

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