# What is the difference b/w and use cases of GetComponentByClass and FindComponentByClass?

**URL:** <https://forums.unrealengine.com/t/what-is-the-difference-b-w-and-use-cases-of-getcomponentbyclass-and-findcomponentbyclass/372492>\
**Category:** Community & Industry Discussion\
**Tags:** actor-component, Class, get, unreal-engine, find, Components, question\
**Created:** [October 5, 2016, 9:19am UTC](https://forums.unrealengine.com/t/what-is-the-difference-b-w-and-use-cases-of-getcomponentbyclass-and-findcomponentbyclass/372492 "2016-10-05T09:19:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![V\_A\_L\_I\_S](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@V\_A\_L\_I\_S](https://forums.unrealengine.com/u/V_A_L_I_S)\
**Post date:** [October 5, 2016, 9:19am UTC](https://forums.unrealengine.com/t/what-is-the-difference-b-w-and-use-cases-of-getcomponentbyclass-and-findcomponentbyclass/372492/1 "2016-10-05T09:19:53Z")

</div>

Have been trying to get a pointer to a `UPhysicsHandleComponent` from the owning Actor using: `UPhysicsHandleComponent* PhysicsHandler = GetOwner()->FindComponentByClass();`  
which works.

What is the real difference between using the `FindComponentByClass<>()` function and `GetComponentByClass()`? Can both be used in similar use cases? If not what are the use cases?

---

<div class="post-metadata">

**Author:** ![savgrace](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@savgrace](https://forums.unrealengine.com/u/savgrace)\
**Post date:** [August 13, 2021, 4:23am UTC](https://forums.unrealengine.com/t/what-is-the-difference-b-w-and-use-cases-of-getcomponentbyclass-and-findcomponentbyclass/372492/2 "2021-08-13T04:23:13Z")

</div>

GetComponentByClass is actually just another alias for the untemplated FindComponentByClass.

If you look at Actor.cpp, you’ll find the following:

```
UActorComponent* AActor::GetComponentByClass(TSubclassOf<UActorComponent> ComponentClass) const
{
	return FindComponentByClass(ComponentClass);
}
```

---

<div class="post-metadata">

**Author:** ![Falkitop](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Falkitop](https://forums.unrealengine.com/u/Falkitop)\
**Post date:** [March 26, 2023, 2:57pm UTC](https://forums.unrealengine.com/t/what-is-the-difference-b-w-and-use-cases-of-getcomponentbyclass-and-findcomponentbyclass/372492/3 "2023-03-26T14:57:31Z")

</div>

I have witnessed this a lot in the source code, is there a reason why they would do that?

---

<div class="post-metadata">

**Author:** ![CoolRabi](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@CoolRabi](https://forums.unrealengine.com/u/CoolRabi)\
**Post date:** [August 16, 2023, 6:57pm UTC](https://forums.unrealengine.com/t/what-is-the-difference-b-w-and-use-cases-of-getcomponentbyclass-and-findcomponentbyclass/372492/4 "2023-08-16T18:57:52Z")

</div>

Pure speculation (I never worked on a super large project like the UE):  
Some developers tend to type in “Find…” for such a function, others “Get…”. This might be a convenient way to just serve both types without some strict company guidelines (or it is for the end user), so that both find the right thing.

It won’t make any difference performancewise which one is used (probably), as a compiler will just optimize the alias to the original.

---

<div class="post-metadata">

**Author:** ![JundRaptor](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JundRaptor](https://forums.unrealengine.com/u/JundRaptor)\
**Post date:** [May 2, 2025, 7:39am UTC](https://forums.unrealengine.com/t/what-is-the-difference-b-w-and-use-cases-of-getcomponentbyclass-and-findcomponentbyclass/372492/5 "2025-05-02T07:39:27Z")

</div>

Digging into this it seems completely arbitrary.

Templated GetComponentByClass simply calls class templated FindComponentByClass.

> template  
> T\* GetComponentByClass() const  
> {  
> return FindComponentByClass();  
> }

But if you want to get components implementing an interface, you either use FindComponentByInterface for a single component (returns AActor\*) or GetComponentsByInterface for multiple components (returns TArray). There isn’t a GetComponentByInterface or a FindComponentsByInterface.

I’d chalk it up to another one of UE’s “constant iteration” pitfalls.
