Hello! I've decided to start working on the documentation, filling in holes where there's GDScript examples but no C# examples, as there seems to be plenty of those types of holes everywhere (since C# is relatively new).
The past couple of days, I've tackled a few sections in the tutorial docs and it's been fairly smooth but today, I'm hitting roadblocks and I really don't like the idea of waiting around for certain things to be addressed.
An example of one of the roadblocks:
On this page, the GDScript shows this code:
func _ready():
seed(12345)
# To use a string as a seed, you can hash it to a number.
seed("Hello world".hash())
And the C# equivalent would be something like:
public override void _Ready()
{
GD.Seed(12345);
// To use a string as a seed, you can hash it to a number.
// This
GD.Seed(checked((ulong)"Hello world".Hash()));
// Or this
var hashed = Convert.ToUInt64("Hello world".Hash());
GD.Seed(hashed);
}
There's undoubtedly other ways to do that in C#, but the problem here is that I can't run that code due to a bug in StringExtensions/Hash() and probably within the mono glue, BUT if everything goes according to plan, that will be fixed.
Now, my question is this; When something like this pops up should I move away from using the broken API and use a standard C# work-a-round/equivalent that accomplishes the same thing? In this case something like:
public override void _Ready()
{
GD.Seed(12345);
// To use a string as a seed, you can hash it to a number.
GD.Seed(checked((ulong)"Hello World".GetHashCode());
}
Or should I stick to the API and assume that this will be in working order in the future?
OR should I just skip these scenarios altogether and move to the next thing?
Anyway, thanks.