UBlendSpace::ForEachImmutableSample
#include "Animation/BlendSpace.h"
Access: public
Specifiers: const
Description
Iterates through every data sample in the blend space, invoking the given function for each one without exposing the underlying array.
Caveats & Gotchas
- • Func is invoked synchronously and inline during the call, so it's safe to capture local state by reference — nothing is deferred.
- • Samples are exposed as const, so this cannot be used to mutate sample values; use the editor-only AddSample/EditSampleValue/DeleteSample functions for that.
Signature
ENGINE_API void ForEachImmutableSample(const TFunctionRef<void(const FBlendSample&)> Func) const; Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Func | const TFunctionRef<void(const FBlendSample&)> | Callback invoked once per blend sample, with a const reference to that sample. | — |
Return Type
void Example
Collect referenced animations C++
TArray<UAnimSequence*> ReferencedAnims;
MyBlendSpace->ForEachImmutableSample([&ReferencedAnims](const FBlendSample& Sample)
{
if (Sample.Animation)
{
ReferencedAnims.Add(Sample.Animation);
}
}); Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?