Navigation
API > API/Runtime > API/Runtime/MassEntity > API/Runtime/MassEntity/FMassEntityManager > API/Runtime/MassEntity/FMassEntityManager/GetOrCreateSharedFragment
References
| Module | MassEntity |
| Header | /Engine/Source/Runtime/MassEntity/Public/MassEntityManager.h |
| Include | #include "MassEntityManager.h" |
template<typename T, typename... TArgs>
const FSharedStruct & GetOrCreateSharedFragment
(
const FConstStructView HashingHelperStruct,
TArgs &&... InArgs
)
Remarks
Returns or creates a shared struct associated to a given shared fragment set of values identified internally by a CRC. Use this overload when a different struct should be used to compute a CRC (i.e., UE::StructUtils::GetStructCrc32) and values can be provided as constructor arguments for the desired shared fragment type e.g.,
USTRUCT() struct FIntSharedFragmentParams {
FInSharedFragmentParams(const int32 InValue) : Value(InValue) {}
int32 Value = 0; };
USTRUCT() struct FIntSharedFragment : public FMassSharedFragment {
FIntSharedFragment(const FIntConstSharedFragmentParams& InParams) : Value(InParams.Value) {}
int32 Value = 0; };
FIntSharedFragmentParams Params(123); const FSharedStruct SharedStruct = EntityManager.GetOrCreateSharedFragment
@params HashingHelperStruct Struct view passed to UE::StructUtils::GetStructCrc32 to compute the CRC @params InArgs List of arguments provided to the constructor of the desired fragment type FSharedStruct to the matching, or newly created shared fragment