EgonVM e55214a398 Started the project... finally...
Started the project. This right now only includes Meta XR and Android setup with VR template. More improvements to come!
2024-05-06 20:03:14 +03:00

25 lines
609 B
C++

// Copyright (c) Meta Platforms, Inc. and affiliates.
#pragma once
namespace OculusXRUtility
{
template <typename T>
T* FindComponentByName(AActor* Actor, const FName& ComponentName)
{
if (IsValid(Actor) && (ComponentName != NAME_None))
{
TArray<T*> ComponentsOfType;
Actor->GetComponents<T>(ComponentsOfType);
T** FoundComponent = ComponentsOfType.FindByPredicate([Name = ComponentName.ToString()](T* Component) { return Component->GetName().Equals(Name); });
if (FoundComponent != nullptr)
{
return *FoundComponent;
}
}
return nullptr;
}
} // namespace OculusXRUtility