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>
const FSharedStruct & GetOrCreateSharedFragment
(
const T & Fragment
)
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 an instance of the desired shared fragment type is available and that can be used directly to compute a CRC (i.e., UE::StructUtils::GetStructCrc32) e.g., USTRUCT() struct FIntSharedFragment : public FMassSharedFragment {
int32 Value = 0; };
FIntSharedFragment Fragment; Fragment.Value = 123; const FSharedStruct SharedStruct = EntityManager.GetOrCreateSharedFragment(Fragment);
@params Fragment Instance of the desired fragment type FSharedStruct to the matching, or newly created shared fragment