Skip to content

Add special notes for null C# Variant in several pages #11077

@GoForceX

Description

@GoForceX

Your Godot version:

v4.4.1.stable.mono.official [49a5bc7b6]

Issue description:

Some function documentation entries for returning a Variant mention the special return value of null. However, in C#, returning null directly is not feasible since Variant is a struct. This creates challenges for developers in identifying the correct approach to handle a null Variant, often requiring them to search through multiple documents for a solution. It is counter-intuitive to tell devs to return null when it is not actually possible to return null.

It might be caused by C# / GDScript inconsistencies, and it might be better to add some notes on these function docs to mention return default or return new Godot.Variant().

URL to the documentation page (if already existing):

https://docs.godotengine.org/en/latest/classes/class_control.html#class-control-private-method-get-drag-data

... Returns null if there is no data to drag ...

... and other doc pages that has the same issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:class referenceIssues and PRs about the class reference, which should be addressed on the Godot engine repositorydiscussiontopic:dotnet

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions