Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ FString FBlueprintComponentReference::ToString() const
return Result.ToString();
}

UActorComponent* FBlueprintComponentReference::GetComponent(AActor* SearchActor) const
UActorComponent* FBlueprintComponentReference::GetComponent(const AActor* SearchActor) const
{
UActorComponent* Result = nullptr;

Expand All @@ -90,7 +90,8 @@ UActorComponent* FBlueprintComponentReference::GetComponent(AActor* SearchActor)
break;
case EBlueprintComponentReferenceMode::Path:
// Variation 2: subobject path
Result = FindObjectFast<UActorComponent>(SearchActor, Value);
// const-cast is used as FindObjectFast does not provide a signature with const AActor*
Result = FindObjectFast<UActorComponent>(const_cast<AActor*>SearchActor, Value);
break;
//case EBlueprintComponentReferenceMode::Dynamic:
// Variation 3: dynamic selection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,15 @@ struct BLUEPRINTCOMPONENTREFERENCE_API FBlueprintComponentReference
*
* @param SearchActor Actor to perform search in
*/
UActorComponent* GetComponent(AActor* SearchActor) const;
UActorComponent* GetComponent(const AActor* SearchActor) const;

/**
* Get the actual component pointer from this reference
*
* @param SearchActor Actor to perform search in
*/
template<typename T>
T* GetComponent(AActor* SearchActor) const
T* GetComponent(const AActor* SearchActor) const
{
return Cast<T>(GetComponent(SearchActor));
}
Expand Down