Open 3D Engine AzFramework API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AzFramework::SpawnableMonitor Class Reference

#include <SpawnableMonitor.h>

Inherits AZ::Data::AssetBus::MultiHandler.

Public Types

enum  IssueType { Error , Cancel , ReloadError }
 

Public Member Functions

 SpawnableMonitor (AZ::Data::AssetId spawnableAssetId)
 
virtual ~SpawnableMonitor ()
 Destroys the monitor, including disconnecting from the spawnable if connected.
 
virtual bool Connect (AZ::Data::AssetId spawnableAssetId)
 
virtual bool Disconnect ()
 Disconnects from the monitor if connected and otherwise does nothing and returns false.
 
virtual bool IsConnected () const
 Returns true if the monitor is connected and otherwise false.
 
virtual bool IsLoaded () const
 Returns true if the monitor tracked the spawnable able being ready for use, otherwise false.
 

Protected Member Functions

virtual void OnSpawnableLoaded ()
 Called when a spawnable has been loaded and is ready for used.
 
virtual void OnSpawnableUnloaded ()
 Called when an spawnable has been unloaded and should no longer be used.
 
virtual void OnSpawnableReloaded (AZ::Data::Asset< Spawnable > &&replacementAsset)
 
virtual void OnSpawnableIssue (IssueType issueType, AZStd::string_view message)
 Called when an error occurred while the Asset Manager did an operation on the spawnable.
 

Detailed Description

A utility class to make it easier to work with individual spawnables. This class will monitor a spawnable for changes and provides a simplified interface to respond to.

Constructor & Destructor Documentation

◆ SpawnableMonitor()

AzFramework::SpawnableMonitor::SpawnableMonitor ( AZ::Data::AssetId  spawnableAssetId)
explicit

Constructs the monitor to immediately start monitoring a specific spawnable. Depending on the state of the spawnable this can result in immediate calls to OnSpawnable* functions.

Member Function Documentation

◆ Connect()

virtual bool AzFramework::SpawnableMonitor::Connect ( AZ::Data::AssetId  spawnableAssetId)
virtual

Connects the monitor to start monitoring a specific spawnable. Depending on the state of the spawnable this can result in immediate calls to OnSpawnable* functions. If the monitor is already connected this will do nothing and return false.

◆ OnSpawnableReloaded()

virtual void AzFramework::SpawnableMonitor::OnSpawnableReloaded ( AZ::Data::Asset< Spawnable > &&  replacementAsset)
protectedvirtual

Called when a spawnable has been reloaded. Note that if the replacement isn't used to replace the original spawnable then the replacement asset will eventually run out of references and send an OnSpawnableUnloaded event.


The documentation for this class was generated from the following file: