com.unity.netcode.gameobjects@1.5.2
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). Additional documentation and release notes are available at [Multiplayer Documentation](https://docs-multiplayer.unity3d.com). ## [1.5.2] - 2023-07-24 ### Added ### Fixed - Fixed issue where `NetworkClient.OwnedObjects` was not returning any owned objects due to the `NetworkClient.IsConnected` not being properly set. (#2631) - Fixed a crash when calling TrySetParent with a null Transform (#2625) - Fixed issue where a `NetworkTransform` using full precision state updates was losing transform state updates when interpolation was enabled. (#2624) - Fixed issue where `NetworkObject.SpawnWithObservers` was not being honored for late joining clients. (#2623) - Fixed issue where invoking `NetworkManager.Shutdown` multiple times, depending upon the timing, could cause an exception. (#2622) - Fixed issue where removing ownership would not notify the server that it gained ownership. This also resolves the issue where an owner authoritative NetworkTransform would not properly initialize upon removing ownership from a remote client. (#2618) - Fixed ILPP issues when using CoreCLR and for certain dedicated server builds. (#2614) - Fixed an ILPP compile error when creating a generic NetworkBehaviour singleton with a static T instance. (#2603) ### Changed
This commit is contained in:
@@ -59,7 +59,7 @@ namespace Unity.Netcode.Editor.CodeGen
|
||||
|
||||
public static bool IsSubclassOf(this TypeDefinition typeDefinition, string classTypeFullName)
|
||||
{
|
||||
if (!typeDefinition.IsClass)
|
||||
if (typeDefinition == null || !typeDefinition.IsClass)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -154,6 +154,10 @@ namespace Unity.Netcode.Editor.CodeGen
|
||||
|
||||
public static bool IsSubclassOf(this TypeReference typeReference, TypeReference baseClass)
|
||||
{
|
||||
if (typeReference == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
var type = typeReference.Resolve();
|
||||
if (type?.BaseType == null || type.BaseType.Name == nameof(Object))
|
||||
{
|
||||
|
||||
@@ -396,6 +396,8 @@ namespace Unity.Netcode.Editor.CodeGen
|
||||
#endif
|
||||
private MethodReference m_NetworkVariableSerializationTypes_InitializeEqualityChecker_ManagedClassEquals_MethodRef;
|
||||
|
||||
private MethodReference m_RuntimeInitializeOnLoadAttribute_Ctor;
|
||||
|
||||
private MethodReference m_ExceptionCtorMethodReference;
|
||||
private MethodReference m_List_NetworkVariableBase_Add;
|
||||
|
||||
@@ -509,6 +511,8 @@ namespace Unity.Netcode.Editor.CodeGen
|
||||
}
|
||||
}
|
||||
|
||||
m_RuntimeInitializeOnLoadAttribute_Ctor = moduleDefinition.ImportReference(typeof(RuntimeInitializeOnLoadMethodAttribute).GetConstructor(new Type[] { }));
|
||||
|
||||
TypeDefinition networkManagerTypeDef = null;
|
||||
TypeDefinition networkBehaviourTypeDef = null;
|
||||
TypeDefinition networkVariableBaseTypeDef = null;
|
||||
@@ -1200,19 +1204,14 @@ namespace Unity.Netcode.Editor.CodeGen
|
||||
|
||||
if (rpcHandlers.Count > 0 || rpcNames.Count > 0)
|
||||
{
|
||||
var staticCtorMethodDef = typeDefinition.GetStaticConstructor();
|
||||
if (staticCtorMethodDef == null)
|
||||
{
|
||||
staticCtorMethodDef = new MethodDefinition(
|
||||
".cctor", // Static Constructor (constant-constructor)
|
||||
MethodAttributes.HideBySig |
|
||||
MethodAttributes.SpecialName |
|
||||
MethodAttributes.RTSpecialName |
|
||||
var staticCtorMethodDef = new MethodDefinition(
|
||||
$"InitializeRPCS_{typeDefinition.Name}",
|
||||
MethodAttributes.Assembly |
|
||||
MethodAttributes.Static,
|
||||
typeDefinition.Module.TypeSystem.Void);
|
||||
staticCtorMethodDef.Body.Instructions.Add(Instruction.Create(OpCodes.Ret));
|
||||
typeDefinition.Methods.Add(staticCtorMethodDef);
|
||||
}
|
||||
staticCtorMethodDef.Body.Instructions.Add(Instruction.Create(OpCodes.Ret));
|
||||
staticCtorMethodDef.CustomAttributes.Add(new CustomAttribute(m_RuntimeInitializeOnLoadAttribute_Ctor));
|
||||
typeDefinition.Methods.Add(staticCtorMethodDef);
|
||||
|
||||
var instructions = new List<Instruction>();
|
||||
var processor = staticCtorMethodDef.Body.GetILProcessor();
|
||||
@@ -1254,7 +1253,8 @@ namespace Unity.Netcode.Editor.CodeGen
|
||||
baseGetTypeNameMethod.ReturnType)
|
||||
{
|
||||
ImplAttributes = baseGetTypeNameMethod.ImplAttributes,
|
||||
SemanticsAttributes = baseGetTypeNameMethod.SemanticsAttributes
|
||||
SemanticsAttributes = baseGetTypeNameMethod.SemanticsAttributes,
|
||||
IsFamilyOrAssembly = true
|
||||
};
|
||||
|
||||
var processor = newGetTypeNameMethod.Body.GetILProcessor();
|
||||
@@ -2225,6 +2225,12 @@ namespace Unity.Netcode.Editor.CodeGen
|
||||
}
|
||||
field = new FieldReference(fieldDefinition.Name, fieldDefinition.FieldType, genericType);
|
||||
}
|
||||
|
||||
if (field.FieldType.Resolve() == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!field.FieldType.IsArray && !field.FieldType.Resolve().IsArray && field.FieldType.IsSubclassOf(m_NetworkVariableBase_TypeRef))
|
||||
{
|
||||
// if({variable} == null) {
|
||||
|
||||
@@ -98,6 +98,14 @@ namespace Unity.Netcode.Editor.CodeGen
|
||||
fieldDefinition.IsPublic = true;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var nestedTypeDefinition in typeDefinition.NestedTypes)
|
||||
{
|
||||
if (nestedTypeDefinition.Name == nameof(NetworkManager.RpcReceiveHandler))
|
||||
{
|
||||
nestedTypeDefinition.IsNestedPublic = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ProcessNetworkBehaviour(TypeDefinition typeDefinition)
|
||||
@@ -114,7 +122,7 @@ namespace Unity.Netcode.Editor.CodeGen
|
||||
{
|
||||
if (fieldDefinition.Name == nameof(NetworkBehaviour.__rpc_exec_stage) || fieldDefinition.Name == nameof(NetworkBehaviour.NetworkVariableFields))
|
||||
{
|
||||
fieldDefinition.IsFamily = true;
|
||||
fieldDefinition.IsFamilyOrAssembly = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,6 +138,11 @@ namespace Unity.Netcode.Editor.CodeGen
|
||||
{
|
||||
methodDefinition.IsFamily = true;
|
||||
}
|
||||
|
||||
if (methodDefinition.Name == nameof(NetworkBehaviour.__getTypeName))
|
||||
{
|
||||
methodDefinition.IsFamilyOrAssembly = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user