godotengine / godotengine/godot-docs

Add special notes for null C# Variant in several pages

Open
#11,077 3 comments 0 reactions 0 assignees View on GitHub
area:class reference discussion topic:dotnet
Dominant language
reStructuredText
Stars
5.7k
Forks
3.8k
Avg merge
1d 20h
Merged PRs (30d)
25

Description

**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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.