UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
MassEntityElementTypes.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "MassEntityElementTypes.generated.h"
6
7// This is the base class for all lightweight fragments
13
14// these are the messages we'll print out when static checks whether a given type is a fragment fails
15#define _MASS_INVALID_FRAGMENT_CORE_MESSAGE "Make sure to inherit from FMassFragment or one of its child-types and ensure that the struct is trivially copyable, or opt out by specializing TMassFragmentTraits for this type and setting AuthorAcceptsItsNotTriviallyCopyable = true"
16#define MASS_INVALID_FRAGMENT_MSG "Given struct doesn't represent a valid fragment type." _MASS_INVALID_FRAGMENT_CORE_MESSAGE
17#define MASS_INVALID_FRAGMENT_MSG_F "Type %s is not a valid fragment type." _MASS_INVALID_FRAGMENT_CORE_MESSAGE
18
19
20// This is the base class for types that will only be tested for presence/absence, i.e. Tags.
21// Subclasses should never contain any member properties.
22USTRUCT()
27
28USTRUCT()
33
34USTRUCT()
39
40USTRUCT()
45
46namespace UE::Mass
47{
48 template<typename T>
49 bool IsA(const UStruct* /*Struct*/)
50 {
51 return false;
52 }
53
54 template<>
55 inline bool IsA<FMassFragment>(const UStruct* Struct)
56 {
57 return Struct && Struct->IsChildOf(FMassFragment::StaticStruct());
58 }
59
60 template<>
61 inline bool IsA<FMassTag>(const UStruct* Struct)
62 {
63 return Struct && Struct->IsChildOf(FMassTag::StaticStruct());
64 }
65
66 template<>
68 {
69 return Struct && Struct->IsChildOf(FMassChunkFragment::StaticStruct());
70 }
71
72 template<>
74 {
75 return Struct && Struct->IsChildOf(FMassSharedFragment::StaticStruct());
76 }
77
78 template<>
80 {
81 return Struct && Struct->IsChildOf(FMassConstSharedFragment::StaticStruct());
82 }
83}
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define GENERATED_BODY(...)
Definition ObjectMacros.h:765
#define USTRUCT(...)
Definition ObjectMacros.h:746
Definition Class.h:480
Definition MassArchetypeData.h:21
bool IsA< FMassSharedFragment >(const UStruct *Struct)
Definition MassEntityElementTypes.h:73
bool IsA(const UStruct *)
Definition MassEntityElementTypes.h:49
bool IsA< FMassTag >(const UStruct *Struct)
Definition MassEntityElementTypes.h:61
bool IsA< FMassFragment >(const UStruct *Struct)
Definition MassEntityElementTypes.h:55
bool IsA< FMassConstSharedFragment >(const UStruct *Struct)
Definition MassEntityElementTypes.h:79
bool IsA< FMassChunkFragment >(const UStruct *Struct)
Definition MassEntityElementTypes.h:67
Definition MassEntityElementTypes.h:30
Definition MassEntityElementTypes.h:42
Definition MassEntityElementTypes.h:10
Definition MassEntityElementTypes.h:36
Definition MassEntityElementTypes.h:24