UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
NetworkGuid.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreTypes.h"
7
12{
13public:
14
15 union
16 {
17 UE_DEPRECATED(5.3, "Deprecated in favor of ObjectId")
20 };
21
23 : ObjectId(0)
24 { }
25
26 UE_DEPRECATED(5.3, "No longer used")
28 : ObjectId(V)
29 { }
30
31 friend bool operator==(const FNetworkGUID& X, const FNetworkGUID& Y)
32 {
33 return (X.ObjectId == Y.ObjectId);
34 }
35
36 friend bool operator!=(const FNetworkGUID& X, const FNetworkGUID& Y)
37 {
38 return (X.ObjectId != Y.ObjectId);
39 }
40
42 {
43 Ar.SerializeIntPacked64(G.ObjectId);
44 return Ar;
45 }
46
47 UE_DEPRECATED(5.3, "No longer used")
52
53 UE_DEPRECATED(5.3, "No longer used")
55 {
56 return ((int32)ObjectId & 1) ? (int32)ObjectId >> 1 : 0;
57 }
58
60 {
61 return ::GetTypeHash(Guid.ObjectId);
62 }
63
64 bool IsDynamic() const
65 {
66 return IsValid() && !IsStatic();
67 }
68
69 bool IsStatic() const
70 {
71 return ObjectId & 1;
72 }
73
74 bool IsValid() const
75 {
76 return ObjectId > 0;
77 }
78
80 bool IsDefault() const
81 {
82 return (ObjectId == 1);
83 }
84
86 {
87 return CreateFromIndex(0, true);
88 }
89
90 void Reset()
91 {
92 ObjectId = 0;
93 }
94
95 FString ToString() const
96 {
97 return FString::Printf(TEXT("%" UINT64_FMT), ObjectId);
98 }
99
100 bool operator<(const FNetworkGUID& Other) const
101 {
102 return ObjectId < Other.ObjectId;
103 }
104
105 UE_DEPRECATED(5.3, "Deprecated in favor of CreateFromIndex")
107 {
108 return CreateFromIndex((uint64)Seed, bIsStatic);
109 }
110
111 static FNetworkGUID CreateFromIndex(uint64 NetIndex, bool bIsStatic)
112 {
113 check(NetIndex <= (MAX_uint64 >> 1));
114
115 FNetworkGUID NewGuid;
116 NewGuid.ObjectId = NetIndex << 1 | (bIsStatic ? 1 : 0);
117
118 return NewGuid;
119 }
120};
OODEFFUNC typedef void(OODLE_CALLBACK t_fp_OodleCore_Plugin_Free)(void *ptr)
#define UINT64_FMT
Definition AndroidPlatformString.h:66
#define check(expr)
Definition AssertionMacros.h:314
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
#define TEXT(x)
Definition Platform.h:1272
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
FPlatformTypes::uint64 uint64
A 64-bit unsigned integer.
Definition Platform.h:1117
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define X(Name, Desc)
Definition FormatStringSan.h:47
#define MAX_uint64
Definition NumericLimits.h:22
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition Archive.h:1208
virtual CORE_API void SerializeIntPacked64(uint64 &Value)
Definition Archive.cpp:1383
Definition NetworkGuid.h:12
bool IsDynamic() const
Definition NetworkGuid.h:64
bool IsDefault() const
Definition NetworkGuid.h:80
void Reset()
Definition NetworkGuid.h:90
friend bool operator!=(const FNetworkGUID &X, const FNetworkGUID &Y)
Definition NetworkGuid.h:36
FString ToString() const
Definition NetworkGuid.h:95
int32 ExtractNetIndex()
Definition NetworkGuid.h:54
static FNetworkGUID GetDefault()
Definition NetworkGuid.h:85
static FNetworkGUID CreateFromIndex(uint64 NetIndex, bool bIsStatic)
Definition NetworkGuid.h:111
bool IsValid() const
Definition NetworkGuid.h:74
uint64 ObjectId
Definition NetworkGuid.h:19
friend uint32 GetTypeHash(const FNetworkGUID &Guid)
Definition NetworkGuid.h:59
static FNetworkGUID Make(int32 Seed, bool bIsStatic)
Definition NetworkGuid.h:106
friend FArchive & operator<<(FArchive &Ar, FNetworkGUID &G)
Definition NetworkGuid.h:41
uint32 Value
Definition NetworkGuid.h:18
bool operator<(const FNetworkGUID &Other) const
Definition NetworkGuid.h:100
bool IsStatic() const
Definition NetworkGuid.h:69
friend bool operator==(const FNetworkGUID &X, const FNetworkGUID &Y)
Definition NetworkGuid.h:31
void BuildFromNetIndex(int32 StaticNetIndex)
Definition NetworkGuid.h:48