-
-
Notifications
You must be signed in to change notification settings - Fork 221
Description
Describe the bug
When using a setter in C# inside a shortcutted autoload (in the "state autoload shortcuts" setting, or via the "using" keyword), attempting to use that setter in a "set" or "do" statement results in an "Assertion failed" error, like this one:
"confidence" not found.
States with directly referenceable properties/methods/signals include "{ "self": <DialogueResource titles="..."> }", "GameState", "Balloon", "main".
Autoloads need to be referenced by their name to use their properties.
The GameState script is globalized, and included in the state autoload shortcuts, and functions perfectly fine otherwise (such as when checking the same confidence variable in a conditional). Further, functions work fine so using a setConfidence(int)
function works as well. Here is the code within GameState, which works well when referencing confidence like GameState.confidence
, but not confidence
alone:
// Variable declarations
private int Confidence;
public int confidence {
get { return Confidence; }
set {
EmitSignal(SignalName.ConfidenceChange, value);
Confidence = value;
}
}
Affected version
- Dialogue Manager version: 3.7.1
- Godot version: 4.4.1 stable mono
To Reproduce
Steps to reproduce the behavior:
- Create a new C# GDM project
- Make a new C# script with the following contents and add it to autoload and state autoload shortcuts
private int Confidence = 0;
public int confidence {
get { return Confidence; }
set { Confidence = value; }
}
public void setConfidence(int value) { confidence = value; }
- Make a new dialogue object with the following contents and run it.
~ start
Test: {{confidence}}
do GameState.confidence += 1
Test: {{confidence}}
do setConfidence(confidence + 1)
Test: {{confidence}}
do confidence += 1 # BREAKS HERE
Test: {{confidence}}
=> END
- Observe confidence increment normally until setter is used, and error is thrown.
Expected behavior
Public setters are exposed to GDM identically to other public objects.