Is there a way to find collision presets in C++?

Rather than manually setting up every inch of collision on a per-object basis in code, I was wondering if anyone knew a means of collecting preset data from the project (in C++) and setting up an object to use that instead? This would immensely help my team as well, since only a couple of us are actually programmers and the rest of us utilize blueprints.

I’m aware of UPrimitiveComponent::GetCollisionProfileName and UPrimitiveComponent::SetCollisionProfileName, but is there a way to get a list of FName's to the profiles which our project utilizes? Or would I just have to constantly run through every single object, adding names to an array? I’m curious what the most efficient way to go about this is.

You can get them from UCollisionProfile instance

TArray<TSharedPtr<FName>> OutNameList;
UCollisionProfile::Get()->GetProfileNames(OutNameList);

or use this functions, like UE is doing.

/** Accessor for UI customization **/
int32 GetNumOfProfiles() const { return Profiles.Num(); }

/** Accessor for UI customization **/
ENGINE_API const FCollisionResponseTemplate* GetProfileByIndex(int32 Index) const;
1 Like