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

Added code examples for Target Data section, showing inheritance and general usage #102

Merged
merged 5 commits into from
Feb 20, 2023

Conversation

YawLighthouse
Copy link
Contributor

Issue associated: #75

This is to add some sort of examples for target data on how to:

  • Inherit from FGameplayAbilityTargetData
  • How to create a FGameplayAbilityTargetDataHandle that uses this type
  • How to type check for the inherited FGameplayAbilityTargetData
  • How to cast for FGameplayAbilityTargetData

Explained how to subclass, how to get values from it(including casting), and how to use it with making a target data handle.
@YawLighthouse YawLighthouse changed the title Added code examples for Target Data Subclassing and general usage Added code examples for Target Data section, showing inheritance and general usage Jan 31, 2023
Copy link
Owner

@tranek tranek left a comment

Choose a reason for hiding this comment

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

Added two minor things that need to be fixed up. Thanks for adding this!

README.md Outdated
UFUNCTION(BlueprintPure)
FName GetCoolNameFromTargetData(const FGameplayAbilityTargetDataHandle& Handle, const int Index)
{
FGameplayAbilityTargetData* data = Handle.Data[Index].Get();
Copy link
Owner

Choose a reason for hiding this comment

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

This should check to make sure that Index is within the Handle.Data array bounds.

Copy link
Owner

Choose a reason for hiding this comment

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

Rename data to something else with a capital letter first to follow Unreal style guide like MyData.

1. Added valid checked index
2. Fixed naming convention
@tranek tranek merged commit 5862f23 into tranek:master Feb 20, 2023
@tranek
Copy link
Owner

tranek commented Feb 20, 2023

Thanks for adding this example!

sentyaanko added a commit to sentyaanko/GASDocumentation that referenced this pull request Feb 24, 2023
fixed type checking error.
fixed typo.
added language identifier in fenced code block.
tranek added a commit that referenced this pull request Feb 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants