Remove custom project setting programmatically

Godot Version



First of all, I’m using the C# API.
Earlier this day, I tried using the ProjectSettings static class in order to create and remove custom settings for an editor plugin. No problem for the creation.

But for the deletion, it is written in the latest godot’s documentation:
(talking about SetSetting):
" This can also be used to erase custom project settings. To do this change the setting value to null ."
The thing is, the second argument, the value, can’t be null. It’s expected to be a Godot.Variant. Which can’t be a C# null value.

Here is my code, which is quite short (with the doc sentence about erase!):

Here is my problem, I don’t know if I’m doing anything wrong here ?
Thanks !

Try Variant.Nil or Something like that.
(See this page)

Hi DrewV3,
Variant.Nil does not exist, it’s a Variant.Type enumerable value. I need a Variant variable with ‘VariantType’ equal to Variant.Type.Nil, yes, but I don’t know how I can achieve this, as I can’t cast a null variable as Variant. And the Obj and VariantType properties are readonly.

Try Godot.Variant.CreateFrom(null)

1 Like

Godot.Variant.CreateFrom(null) is ambiguous, but the correct answer still.
The right way was Godot.Variant.CreateFrom< string >(null).

Thanks !

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.