UAISense

Choose your operating system:

Windows

macOS

Linux

Inheritance Hierarchy

References

Module

AIModule

Header

/Engine/Source/Runtime/AIModule/Classes/Perception/AISense.h

Include

#include "Perception/AISense.h"

Syntax

class UAISense : public UObject

Variables

Name Description

Protected variable

uint32: 1

 

bAutoRegisterAllPawnsAsSources

If true all newly spawned pawns will get auto registered as source for this sense.

Protected variable

uint32: 1

 

bNeedsForgettingNotification

This sense has some internal logic that requires it to be notified when a listener wants to forget an actor

Protected variable

uint32: 1

 

bWantsNewPawnNotification

Whether this sense is interested in getting notified about new Pawns being spawned this can be used for example for automated sense sources registration

Protected variable

EAISenseNotifyT...

 

NotifyType

Protected variable

FOnPerceptionLi...

 

OnListenerRemovedDelegate

If bound will be called when a FPerceptionListener's in removed from AIPerceptionSystem

Protected variable

FOnPerceptionLi...

 

OnListenerUpdateDelegate

If bound will be called when a FPerceptionListener's in AIPerceptionSystem change

Protected variable

FOnPerceptionLi...

 

OnNewListenerDelegate

If bound will be called when new FPerceptionListener gets registers with AIPerceptionSystem

Protected variable

friend

 

UAIPerceptionSystem

Constructors

Name Description

Public function

UAISense

(
    const FObjectInitializer& ObjectIn...
)

Functions

Name Description

Protected function

void

 

ForceSenseID

(
    FAISenseID SenseID
)

To be called only for BP-generated classes

Protected function

AIPerception...

 

GetListeners()

Returning pointer rather then a reference to prevent users from accidentally creating copies by creating non-reference local vars

Protected function

UAIPerceptio...

 

GetPerceptionSystem()

Public function Const

FAISenseID

 

GetSenseID()

Public function Static

FAISenseID

 

GetSenseID()

Public function Static

FAISenseID

 

GetSenseID

(
    const TSubclassOf< UAISense > Sense...
)

Public function Virtual Const

UWorld *

 

GetWorld()

Public function Static

void

 

HardcodeSenseID

(
    TSubclassOf< UAISense > SenseClass,
    FAISenseID HardcodedID
)

Use with caution! Needs to be called before any senses get instantiated or listeners registered.

Public function Const

bool

 

NeedsNotificationOnForgetting()

Public function Virtual

void

 

OnListenerConfigUpdated

(
    const FPerceptionListener& Updated...
)

Public function Virtual

void

 

OnListenerForgetsActor

(
    const FPerceptionListener& Listene...,
    AActor& ActorToForget
)

Public function Virtual

void

 

OnListenerForgetsAll

(
    const FPerceptionListener& Listene...
)

Public function

void

 

OnListenerRemoved

(
    const FPerceptionListener& Removed...
)

Public function

void

 

OnListenerUpdate

(
    const FPerceptionListener& Updated...
)

Public function

void

 

OnNewListener

(
    const FPerceptionListener& NewList...
)

Protected function Virtual

void

 

OnNewPawn

(
    APawn& NewPawn
)

Gets called when perception system gets notified about new spawned pawn.

Public function

bool

 

ProgressTime

(
    float DeltaSeconds
)

Public function Virtual

void

 

RegisterSource

(
    AActor& SourceActors
)

Virtual void RegisterSources(TArray SourceActors) {}

Public function Virtual

void

 

RegisterWrappedEvent

(
    UAISenseEvent& PerceptionEvent
)

Protected function

void

 

RequestImmediateUpdate()

Will result in updating as soon as possible

Protected function

void

 

RequestUpdateInSeconds

(
    float UpdateInSeconds
)

Will result in updating in specified number of seconds

Protected function

void

 

SetSenseID

(
    FAISenseID Index
)

Public function Const

bool

 

ShouldAutoRegisterAllPawnsAsSources()

Public function

void

 

Tick()

Public function Virtual

void

 

UnregisterSource

(
    AActor& SourceActors
)

Protected function Virtual

float

 

Update()

Public function Virtual

FAISenseID

 

UpdateSenseID()

Public function Const

bool

 

WantsNewPawnNotification()

Public function Const

bool

 

WantsUpdateOnlyOnPerceptionValueChange()

Overridden from UObject

Name Description

Public function Virtual

void

 

PostInitProperties()

Called after the C++ constructor and after the properties have been initialized, including those loaded from config.

Constants

Name

Description

SuspendNextUpdate

Deprecated Variables

Name Description

Protected variable

float

 

DefaultExpirationAge

This property will be removed in future versions. Use AISenseConfig::MaxAge instead.

Deprecated Functions

Name Description

Public function Virtual

void

 

CleanseInvalidSources()

This method is no longer used and will be removed in future versions. UnregisterSource is called by AActor.OnEndPlay delegate and will perform the cleanup.

Protected function Const

FColor

 

GetDebugColor()

Function removed, use AISenseConfig.GetDebugColor() instead.

Protected function Virtual Const

FString

 

GetDebugLegend()

Function removed, use AISenseConfig.DescribeSelfToGameplayDebugger() instead.

Protected function Const

FString

 

GetDebugName()

Function removed, use AISenseConfig.GetSenseName() instead.

Public function Const

float

 

GetDefaultExpirationAge()

This method will be removed in future versions. Perception relies on AISenseConfig::MaxAge so the value returned is no longer used by the perception system.