Skip to content

Conversation

@31
Copy link
Contributor

@31 31 commented Jan 15, 2024

This example should use SignalName to show the best practice, and in my opinion it should show the async method signature for context and as a hint for anyone new to await.

The SceneTreeTimer example does it this way: https://docs.godotengine.org/en/latest/classes/class_scenetreetimer.html

public async Task SomeFunction()
{
    GD.Print("Timer started.");
    await ToSignal(GetTree().CreateTimer(1.0f), SceneTreeTimer.SignalName.Timeout);
    GD.Print("Timer ended.");
}

Being able to pass a "raw" StringName is important for cross-language scripting when you don't have SignalName generation, but that detail belongs in the cross-language scripting page.

(From godotengine/godot-docs-user-notes#7 (comment))

@AThousandShips AThousandShips added enhancement topic:dotnet area:manual Issues and PRs related to the Manual/Tutorials section of the documentation labels Jan 15, 2024
@AThousandShips AThousandShips requested a review from a team January 15, 2024 16:31
Copy link
Member

@raulsntos raulsntos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

@skyace65 skyace65 merged commit c6e668b into godotengine:master Jan 16, 2024
@skyace65
Copy link
Contributor

Thanks!

@31 31 deleted the patch-1 branch January 16, 2024 09:32
mhilbrunner pushed a commit that referenced this pull request Jan 25, 2024
Update c_sharp_differences.rst ToSignal example
@mhilbrunner
Copy link
Member

Cherry-picked to 4.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:manual Issues and PRs related to the Manual/Tutorials section of the documentation enhancement topic:dotnet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants