#include <InstanceDatabase.h>
Public Types | |
using | CreateFunction = AZStd::function< Instance< Type >(AssetData *)> |
using | CreateFunctionWithParam = AZStd::function< Instance< Type >(AssetData *, const AZStd::any *param)> |
using | DeleteFunction = AZStd::function< void(Type *)> |
Public Attributes | |
CreateFunction | m_createFunction = nullptr |
CreateFunctionWithParam | m_createFunctionWithParam = nullptr |
DeleteFunction | m_deleteFunction = [](Type* t) { delete t; } |
[Optional] The function to use when deleting an instance. | |
Provides create and delete functions for a specific InstanceData type, for use by InstanceDatabase
using AZ::Data::InstanceHandler< Type >::CreateFunction = AZStd::function<Instance<Type>(AssetData*)> |
Creation takes an asset as input and produces a new instance as output. Ownership must be returned to the caller. Use this method to perform both allocation and initialization using the provided asset. The returned instance is assumed to be valid and usable by the client.
Usage Examples:
PERFORMANCE NOTE: Creation is currently done under a lock. Initialization should be quick.
using AZ::Data::InstanceHandler< Type >::DeleteFunction = AZStd::function<void(Type*)> |
Deletion takes an asset as input and transfers ownership to the method.
CreateFunction AZ::Data::InstanceHandler< Type >::m_createFunction = nullptr |
A function to use when creating an instance. The system will assert if both @m_createFunction and @m_createFunctionWithParam creation functions are invalid.
CreateFunctionWithParam AZ::Data::InstanceHandler< Type >::m_createFunctionWithParam = nullptr |
A function with an additional custom param to use when creating an instance. The system will assert if both @m_createFunction and @m_createFunctionWithParam creation functions are invalid.