Skip to content

Commit

Permalink
3.11.5R
Browse files Browse the repository at this point in the history
- Fixed NetworkTransform.SynchronizeParent sometimes unparenting objects.
- Fixed DDOL instance never being set. PR502.
- Fixed Prediction v2(experimental) objects not deinitializing on clients when unexpectedly destroyed.
- Fixed NetworkTransform not always deinitializing properly when an object was unexpectedly destroyed.
  • Loading branch information
FirstGearGames committed Oct 16, 2023
1 parent 4dd2595 commit aba31ca
Show file tree
Hide file tree
Showing 26 changed files with 156 additions and 121 deletions.
1 change: 1 addition & 0 deletions Assets/FishNet/CONTRIBUTORS.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This file exist only for contributors to submit their name via pull request.
7 changes: 7 additions & 0 deletions Assets/FishNet/CONTRIBUTORS.txt.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ internal void CreateReplicateDelegate(MethodDefinition originalMethodDef, Method
/// <param name="rpcType"></param>
internal void CreateRpcDelegate(bool runLocally, TypeDefinition typeDef, MethodDefinition readerMethodDef, RpcType rpcType, uint methodHash, CustomAttribute rpcAttribute)
{



MethodDefinition methodDef = typeDef.GetMethod(NetworkBehaviourProcessor.NETWORKINITIALIZE_EARLY_INTERNAL_NAME);
ILProcessor processor = methodDef.Body.GetILProcessor();
Expand Down
4 changes: 2 additions & 2 deletions Assets/FishNet/CodeGenerating/ILCore/FishNetILPP.cs
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ private bool CreateQOLAttributes(CodegenSession session)
bool modified = false;

bool codeStripping = false;


List<TypeDefinition> allTypeDefs = session.Module.Types.ToList();

/* First pass, potentially only pass.
Expand All @@ -293,7 +293,7 @@ private bool CreateQOLAttributes(CodegenSession session)
modified |= session.GetClass<QolAttributeProcessor>().Process(td, codeStripping);
}




return modified;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ internal bool ProcessLocal(TypeDefinition typeDef, List<(SyncType, ProcessedSync
if (HasClassBeenProcessed(td))
continue;




/* Prediction. */
/* Run prediction first since prediction will modify
Expand Down Expand Up @@ -246,7 +246,7 @@ internal bool NonNetworkBehaviourHasInvalidAttributes(Collection<TypeDefinition>
return false;
}




/// <summary>
/// Calls the next awake method if the nested awake was created by codegen.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ internal bool Process(TypeDefinition typeDef, bool moveStrippedCalls)
bool modified = false;
List<MethodDefinition> methods = typeDef.Methods.ToList();




foreach (MethodDefinition md in methods)
{
Expand Down Expand Up @@ -152,14 +152,14 @@ private void CreateAttributeMethod(MethodDefinition methodDef, CustomAttribute q

bool StripMethod(MethodDefinition md)
{



//Fall through.
return false;
}
}



}

}
12 changes: 6 additions & 6 deletions Assets/FishNet/CodeGenerating/Processing/Rpc/RpcProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ private MethodDefinition CreateRpcWriterMethod(List<ParameterDefinition> seriali
{
intentionallyNull = false;




string methodName = $"{WRITER_PREFIX}{GetRpcMethodName(cr)}";
/* If method already exist then clear it. This
Expand Down Expand Up @@ -379,7 +379,7 @@ private bool CreateClientRpcWriterMethod(List<ParameterDefinition> serializedPar
/* Creates basic ServerRpc and ClientRpc
* conditions such as if requireOwnership ect..
* or if (!base.isClient) */


CreateClientRpcConditionsForServer(writerMd);

VariableDefinition channelVariableDef = CreateAndPopulateChannelVariable(writerMd, channelParameterDef);
Expand Down Expand Up @@ -437,7 +437,7 @@ private bool CreateServerRpcWriterMethod(List<ParameterDefinition> serializedPar
/* Creates basic ServerRpc
* conditions such as if requireOwnership ect..
* or if (!base.isClient) */


CreateServerRpcConditionsForClient(writerMd, cr.Attribute);

VariableDefinition channelVariableDef = CreateAndPopulateChannelVariable(writerMd, channelParameterDef);
Expand Down Expand Up @@ -503,7 +503,7 @@ private MethodDefinition CreateRpcReaderMethod(List<ParameterDefinition> seriali
MethodDefinition logicMd = cr.LogicMethodDef;
CustomAttribute rpcAttribute = cr.Attribute;




string methodName = $"{READER_PREFIX}{GetRpcMethodName(cr)}";
/* If method already exist then just return it. This
Expand Down Expand Up @@ -876,7 +876,7 @@ private MethodDefinition CreateRpcLogicMethod(List<AttributeData> datas, Created
TypeDefinition typeDef = cr.TypeDef;
MethodDefinition originalMd = cr.OriginalMethodDef;




//Methodname for logic methods do not use prefixes because there can be only one.
string methodName = $"{LOGIC_PREFIX}{GetMethodNameAsParameters(originalMd)}";
Expand Down Expand Up @@ -933,7 +933,7 @@ private void RedirectOriginalToWriter(List<CreatedRpc> createdRpcs)
* entry. */
MethodDefinition originalMd = createdRpcs[0].OriginalMethodDef;




ILProcessor processor = originalMd.Body.GetILProcessor();
originalMd.Body.Instructions.Clear();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ private void Awake()
{
//Check for pro...this will stay false if not on a pro package.
bool isPro = false;


if (!isPro)
{
Debug.LogError($"Network Level of Detail demo requires Fish-Networking Pro to work.");
Expand Down
2 changes: 1 addition & 1 deletion Assets/FishNet/Plugins/GameKit/Utilities/Objects.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static List<T> FindAllObjectsOfType<T>(bool activeSceneOnly = true, bool
//If to also include DDOL.
if (includeDDOL)
{
GameObject ddolGo = DDOL.GetDDOL().gameObject;
GameObject ddolGo = DDOL.GetDDOL().gameObject;
results.AddRange(ddolGo.GetComponentsInChildren<T>(includeInactive));
}

Expand Down
20 changes: 13 additions & 7 deletions Assets/FishNet/Plugins/GameKit/Utilities/Types/DDOL.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using System;
using System;
using UnityEngine;

namespace GameKit.Utilities.Types
{


public class DDOL : MonoBehaviour
{
#region Public.
Expand All @@ -11,8 +13,8 @@ public class DDOL : MonoBehaviour
/// </summary>
[Obsolete("Use GetDDOL().")] //Remove on 2023/06/01.
public static DDOL Instance => GetDDOL();
/// <summary>
/// Created instance of DDOL.
/// <summary>
/// Created instance of DDOL.
/// </summary>
private static DDOL _instance;
#endregion
Expand All @@ -29,12 +31,16 @@ public static DDOL GetDDOL()
obj.name = "FirstGearGames DDOL";
DDOL ddol = obj.AddComponent<DDOL>();
DontDestroyOnLoad(ddol);

return _instance = ddol;
_instance = ddol;
return ddol;
}

//Already made.
return _instance;
else
{
return _instance;
}
}
}


}
12 changes: 6 additions & 6 deletions Assets/FishNet/Runtime/Editor/CodeStripping.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace FishNet.Configuring


public class CodeStripping


{

/// <summary>
Expand All @@ -35,7 +35,7 @@ public static bool RemoveServerLogic
{
get
{



/* This is to protect non pro users from enabling this
* without the extra logic code. */
Expand All @@ -51,7 +51,7 @@ public static bool StripBuild
{
get
{



/* This is to protect non pro users from enabling this
* without the extra logic code. */
Expand All @@ -75,7 +75,7 @@ public void OnPreprocessBuild(BuildReport report)
CompilationPipeline.compilationStarted += CompilationPipelineOnCompilationStarted;
CompilationPipeline.compilationFinished += CompilationPipelineOnCompilationFinished;



}
/* Solution for builds ending with errors and not triggering OnPostprocessBuild.
* Link: https://gamedev.stackexchange.com/questions/181611/custom-build-failure-callback
Expand All @@ -100,14 +100,14 @@ private void CompilationPipelineOnCompilationFinished(object compilationContext)

private void BuildingEnded()
{



Generator.IgnorePostProcess = false;
}

public void OnPostprocessBuild(BuildReport report)
{


BuildingEnded();
}
}
Expand Down
4 changes: 2 additions & 2 deletions Assets/FishNet/Runtime/Editor/ScriptingDefines.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static void AddDefineSymbols()
{
"FISHNET",
thisVersion,


};
bool modified = false;
//Now add FN defines.
Expand All @@ -59,7 +59,7 @@ public static void AddDefineSymbols()

/* Remove pro define if not on pro. This might look a little
* funny because the code below varies depending on if pro or not. */


#pragma warning disable CS0162 // Unreachable code detected
modified |= definesHs.Remove(proDefine);
#pragma warning restore CS0162 // Unreachable code detected
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public override void OnInspectorGUI()
EditorGUILayout.ObjectField("Script:", MonoScript.FromMonoBehaviour(na), typeof(NetworkAnimator), false);
GUI.enabled = true;



#pragma warning disable CS0162 // Unreachable code detected
EditorGUILayout.HelpBox(EditingConstants.PRO_ASSETS_LOCKED_TEXT, MessageType.Warning);
#pragma warning restore CS0162 // Unreachable code detected
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ private void InitializeOnce()
foreach (AnimatorControllerParameter item in _animator.parameters)
{
bool process = !_animator.IsParameterControlledByCurve(item.name);


if (process)
{
//Over 250 parameters; who would do this!?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public override void OnInspectorGUI()
GameKitEditing.AddObjectField("Script:", MonoScript.FromMonoBehaviour((NetworkTransform)target), typeof(NetworkTransform), false, EditorLayoutEnableType.Disabled);

bool isPro = false;


if (isPro)
EditorGUILayout.HelpBox(EditingConstants.PRO_ASSETS_UNLOCKED_TEXT, MessageType.None);
else
Expand Down
Loading

0 comments on commit aba31ca

Please sign in to comment.