RealDocs

UAnimInstance::LockAIResources

function Engine Blueprint Deprecated Since 4.7
Deprecated: Use LockAIResourcesWithAnimation instead
#include "Animation/AnimInstance.h"
Access: public Specifiers: ENGINE_APIUFUNCTIONBlueprintCallable

Description

Locks AI movement and/or logic resources on the owning pawn's AI controller so that the animation can take exclusive control during an animation-driven sequence. Deprecated since UE 5.0 — use `LockAIResourcesWithAnimation` instead.

Caveats & Gotchas

  • Deprecated: calling this in UE 5 will emit a deprecation warning. Replace with `LockAIResourcesWithAnimation`, which ties the lock lifetime to an animation montage and avoids permanent lock-outs.
  • BlueprintAuthorityOnly — does nothing on clients in a multiplayer game, which can cause client animations to look desynchronized if the lock is not replicated separately.

Signature

UFUNCTION(BlueprintCallable, Category = "Animation", BlueprintAuthorityOnly, Meta=(DeprecatedFunction, DeprecationMessage="Use LockAIResourcesWithAnimation instead"))
ENGINE_API void LockAIResources(bool bLockMovement, bool LockAILogic)

Parameters

Name Type Description Default
bLockMovement bool If true, locks the AI movement resource so the AI controller cannot issue movement requests.
LockAILogic bool If true, locks the AI logic (Behavior Tree) resource.

Return Type

void

Example

Legacy usage (avoid in new code) C++
// Deprecated — prefer LockAIResourcesWithAnimation
AnimInstance->LockAIResources(true, true);
// ... play montage ...
AnimInstance->UnlockAIResources(true, true);

Version History

Introduced in: 4.7

Version Status Notes
5.6 deprecated Use LockAIResourcesWithAnimation instead.
5.0 deprecated Deprecated in UE 5.0.

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.