Skip to content

C# failed to get inherited property of an object in the dialogue #1215

@ericeric284

Description

@ericeric284

Describe the bug
If the dialogue manager accesses an C# object, it can not access the object's inherited property.

Affected version

  • Dialogue Manager version: v3.10.4
  • Godot version: 4.6.3

To Reproduce
Details can be seen in my reproduce repo https://github.com/ericeric284/GDDialogueProeprtyTest

Steps to reproduce the behavior:

  1. Create the following classes
//ReproBaseNode.cs
using Godot;

public partial class ReproBaseNode : Node
{
    public string InheritedField = "Inherited value from base";
}

//ReproChildNode.cs
using Godot;

public partial class ReproChildNode : ReproBaseNode
{
    public string ChildField = "Child value";
}
  1. Create a global autoload service MyGlobal, that creates a ReproChildNode as its child node, with method GetReproChildNode() to access it.
  2. Create a dilaogue with line {{MyGlobal.GetReproChildNode().InheritedField}}, this will show < null > instead of Inherited value from base

Expected behavior
{{MyGlobal.GetReproChildNode().InheritedField}} should show Inherited value from base
however it will show < null >

Possible workaround
This workaround may solve the problem, but I didn't do a lot of test with this solution.

Edit DialogueManager.cs,
For ThingHasConstant() and ResolveThingConstant(), remove "| BindingFlags.DeclaredOnly".

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions