Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated C# example of AddPropertyInfo #80851

Merged
merged 1 commit into from
Aug 22, 2023
Merged

Updated C# example of AddPropertyInfo #80851

merged 1 commit into from
Aug 22, 2023

Conversation

vitormaduro
Copy link
Contributor

Currently, the C# example of the method AddPropertyInfo looks like this:

var propertyInfo = new Godot.Collections.Dictionary
		{
			{"name", "category/propertyName"},
			{"type", Variant.Type.Int},
			{"hint", PropertyHint.Enum},
			{"hint_string", "one,two,three"},
		};

image

However, the code above produces an error if copied exactly, because Godot cannot convert a Variant.Type or a PropertyHint variable into a Variant one. Casting both variables to int fixes the issue:

var propertyInfo = new Godot.Collections.Dictionary
		{
			{"name", "category/propertyName"},
			{"type", (int)Variant.Type.Int},
			{"hint", (int)PropertyHint.Enum},
			{"hint_string", "one,two,three"},
		};

image

@vitormaduro vitormaduro requested a review from a team as a code owner August 21, 2023 14:08
@raulsntos raulsntos added this to the 4.2 milestone Aug 21, 2023
@raulsntos
Copy link
Member

Thanks for contributing to the .NET documentation! Since this is your first PR, make sure to read CONTRIBUTING.md.

You'll have to squash the commits into one, you can see how in the PR workflow documentation page. If you need help, feel free to reach out in Rocket Chat.

Also, please amend the commit message to something more descriptive.

@vitormaduro
Copy link
Contributor Author

Oops, sorry for that. I updated the commit message and squashed both commits into a single one

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!

@akien-mga akien-mga added the cherrypick:4.1 Considered for cherry-picking into a future 4.1.x release label Aug 21, 2023
@akien-mga akien-mga merged commit 0024d2e into godotengine:master Aug 22, 2023
@akien-mga
Copy link
Member

Thanks! And congrats for your first merged Godot contribution 🎉

@YuriSizov YuriSizov removed the cherrypick:4.1 Considered for cherry-picking into a future 4.1.x release label Oct 24, 2023
@YuriSizov
Copy link
Contributor

Cherry-picked for 4.1.3.

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

Successfully merging this pull request may close these issues.

4 participants