Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .yamato/project.metafile
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,14 @@ test_platforms:

validation_editors:
default:
- 6000.7
- trunk

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1

Changing only default and minimal does not make CI trunk-only: the weekly workflow expands validation_editors.all for package, project, player, and other tests, and that list still contains 6000.7.0a6 and 6000.7. Those released editors retain Netcode for Entities as a core package, the incompatibility this change is avoiding by adding the direct 7.0.0 dependency, so the weekly jobs will either fail resolving the package set or no longer validate the intended dependency. Temporarily make all trunk-only as well (or exclude all-dependent jobs) until the compatible editor release is available.

🤖 Helpful? 👍/👎

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

known thing and this is temporary

all:
- 6000.7.0a6
- 6000.7
- trunk
- 1d47644d0e359a8139ae6f99217da3c4e47f4779
minimal:
- 6000.7.0a6
- trunk
pinnedTrunk: 1d47644d0e359a8139ae6f99217da3c4e47f4779


Expand Down
14 changes: 9 additions & 5 deletions com.unity.netcode.gameobjects/Editor/NetworkObjectEditor.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System.Collections.Generic;
#if UNIFIED_NETCODE
using Unity.NetCode;
using Unity.NetCode.Editor;
using Unity.Netcode.Editor;
#endif
using UnityEditor;
using UnityEngine;
Expand Down Expand Up @@ -42,10 +41,15 @@ private static void OnApplicationStart()
/// <param name="gameObject">The <see cref="GameObject"/> with the <see cref="GhostObject"/> component being removed.</param>
private static void OnGhostObjectPreRemoval(GameObject gameObject)
{
var ghostBehaviours = gameObject.GetComponentsInChildren<GhostBehaviour>();
for (int i = ghostBehaviours.Length - 1; i >= 0; i--)
// GhostBehaviour is internal to N4E and its IVT grant to this assembly differs between N4E's editor-bundled and standalone builds, so resolve it via reflection to stay build-agnostic.
var ghostBehaviourType = typeof(NetcodeWorld).Assembly.GetType("Unity.Netcode.GhostBehaviour");
if (ghostBehaviourType != null)
{
DestroyImmediate(ghostBehaviours[i], true);
var ghostBehaviours = gameObject.GetComponentsInChildren(ghostBehaviourType);
for (int i = ghostBehaviours.Length - 1; i >= 0; i--)
{
DestroyImmediate(ghostBehaviours[i], true);
}
}
var networkObject = gameObject.GetComponent<NetworkObject>();
networkObject.GhostObject = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ namespace Unity.Netcode.Components
/// resulting in a "snap" to the new value if it is different from the anticipated value.</description></item>
///
/// <item><description><b>Smooth:</b> In this mode (with <see cref="StaleDataHandling"/> set to
/// <see cref="Netcode.StaleDataHandling.Ignore"/> and an <see cref="NetworkBehaviour.OnReanticipate"/> callback that calls
/// <see cref="StaleDataHandling.Ignore"/> and an <see cref="NetworkBehaviour.OnReanticipate"/> callback that calls
/// <see cref="Smooth"/> from the anticipated value to the authority value with an appropriate
/// <see cref="Mathf.Lerp"/>-style smooth function), when a more up-to-date value is received from the authority,
/// it will interpolate over time from an incorrect anticipated value to the correct authoritative value.</description></item>
///
/// <item><description><b>Constant Reanticipation:</b> In this mode (with <see cref="StaleDataHandling"/> set to
/// <see cref="Netcode.StaleDataHandling.Reanticipate"/> and an <see cref="NetworkBehaviour.OnReanticipate"/> that calculates a
/// <see cref="StaleDataHandling.Reanticipate"/> and an <see cref="NetworkBehaviour.OnReanticipate"/> that calculates a
/// new anticipated value based on the current authoritative value), when a more up-to-date value is received from
/// the authority, user code calculates a new anticipated value, possibly calling <see cref="Smooth"/> to interpolate
/// between the previous anticipation and the new anticipation. This is useful for values that change frequently and
Expand Down Expand Up @@ -101,11 +101,11 @@ private void Reset()
/// Defines what the behavior should be if we receive a value from the server with an earlier associated
/// time value than the anticipation time value.
/// <br/><br/>
/// If this is <see cref="Netcode.StaleDataHandling.Ignore"/>, the stale data will be ignored and the authoritative
/// If this is <see cref="StaleDataHandling.Ignore"/>, the stale data will be ignored and the authoritative
/// value will not replace the anticipated value until the anticipation time is reached. <see cref="OnAuthoritativeValueChanged"/>
/// and <see cref="OnReanticipate"/> will also not be invoked for this stale data.
/// <br/><br/>
/// If this is <see cref="Netcode.StaleDataHandling.Reanticipate"/>, the stale data will replace the anticipated data and
/// If this is <see cref="StaleDataHandling.Reanticipate"/>, the stale data will replace the anticipated data and
/// <see cref="OnAuthoritativeValueChanged"/> and <see cref="OnReanticipate"/> will be invoked.
/// In this case, the authoritativeTime value passed to <see cref="OnReanticipate"/> will be lower than
/// the anticipationTime value, and that callback can be used to calculate a new anticipated value.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#if UNIFIED_NETCODE
using Unity.NetCode;
using Unity.Transforms;
using UnityEngine;

namespace Unity.Netcode
Expand All @@ -13,7 +13,7 @@ namespace Unity.Netcode

[DefaultExecutionOrder(GhostObject.ExecutionOrder + 1)]
//BREAK --- Fix this on UNIFIED side 1st
public partial class NetworkObjectBridge : GhostBehaviour
internal partial class NetworkObjectBridge : GhostBehaviour
{
// DefaultExecutionOrder
// TODO: Define a const for the value used on GhostObject and use that value
Expand Down Expand Up @@ -83,5 +83,32 @@ internal void ApplyScale(Vector3 scale)
Ghost.ApplyPostTransformMatrixScale(scale);
}
}

/// <summary>
/// Replaces the N4E <c>GhostObject.ApplyPostTransformMatrixScale</c> helper that was removed by the 6.7.0
/// PostTransformMatrix scale rework, keeping NGO's hybrid parenting scale path working without an N4E change.
/// </summary>
internal static class GhostObjectScaleExtensions
{
internal static void ApplyPostTransformMatrixScale(this GhostObject ghost, Vector3 scale)
{
var entityManager = ghost.World.EntityManager;
var entity = ghost.Entity;
if (entityManager.HasComponent<PostTransformMatrix>(entity))
{
entityManager.SetComponentData(entity, new PostTransformMatrix { Value = Mathematics.float4x4.Scale(scale) });
}
else if (Mathf.Approximately(scale.x, scale.y) && Mathf.Approximately(scale.y, scale.z))
{
var localTransform = entityManager.GetComponentData<LocalTransform>(entity);
localTransform.Scale = scale.x;
Comment thread
michalChrobot marked this conversation as resolved.
entityManager.SetComponentData(entity, localTransform);
}
else
{
entityManager.AddComponentData(entity, new PostTransformMatrix { Value = Mathematics.float4x4.Scale(scale) });
}
}
}
}
#endif
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#if UNIFIED_NETCODE
using System;
using Unity.Entities;
using Unity.NetCode;
using UnityEngine;

namespace Unity.Netcode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Collections.Generic;
using Unity.Collections;
using Unity.Entities;
using Unity.NetCode;
using UnityEngine;

namespace Unity.Netcode.Components
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,7 @@ internal void InternalOnNetworkDespawn()
}

/// <summary>
/// In client-server contexts, this method is invoked on both the server and the local client of the owner when <see cref="Netcode.NetworkObject"/> ownership is assigned.
/// In client-server contexts, this method is invoked on both the server and the local client of the owner when <see cref="NetworkObject"/> ownership is assigned.
/// In distributed authority contexts, this method is invoked on all clients connected to the session.
/// </summary>
public virtual void OnGainedOwnership() { }
Expand Down Expand Up @@ -952,7 +952,7 @@ internal void InternalOnOwnershipChanged(ulong previous, ulong current)
}

/// <summary>
/// In client-server contexts, this method is invoked on the local client when it loses ownership of the associated <see cref="Netcode.NetworkObject"/>
/// In client-server contexts, this method is invoked on the local client when it loses ownership of the associated <see cref="NetworkObject"/>
/// and on the server when any client loses ownership.
/// In distributed authority contexts, this method is invoked on all clients connected to the session.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
// Netcode for Entities' namespace differs from this one only by the casing of a single letter, so a
// blanket import of it competes with Unity.Netcode on every name the two happen to share. Importing
// only the types used here keeps that surface to exactly those names.
using NetCodeConfig = Unity.NetCode.NetCodeConfig;
using NetcodeWorld = Unity.NetCode.NetcodeWorld;
using NetCodeConfig = Unity.Netcode.NetcodeConfig;
#endif
using Unity.Netcode.Components;
using Unity.Netcode.GameObjects.Timing;
Expand Down Expand Up @@ -1375,13 +1374,13 @@ internal void InitializeNetcodeWorld()

if (this == Singleton)
{
if (NetCode.Netcode.IsActive)
if (Netcode.IsActive)
{
Log.Info(new Context(LogLevel.Normal, "Netcode is not active but has an instance at this point."));
}
/// !! Important !!
/// Clear out any pre-existing configuration in the event this applicatioin instance has already been connected to a session.
NetCode.Netcode.Reset();
Netcode.Reset();
}

/// !! Initialize worlds here !!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using Unity.Netcode.Logging;
using Unity.Netcode.Runtime;
#if UNIFIED_NETCODE
using Unity.NetCode;
#endif

#if UNITY_EDITOR
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,18 @@ public enum StaleDataHandling
/// <list type="bullet">
///
/// <item><description><b>Snap:</b> In this mode (with <see cref="StaleDataHandling"/> set to
/// <see cref="Netcode.StaleDataHandling.Ignore"/> and no <see cref="NetworkBehaviour.OnReanticipate"/> callback),
/// <see cref="StaleDataHandling.Ignore"/> and no <see cref="NetworkBehaviour.OnReanticipate"/> callback),
/// the moment a more up-to-date value is received from the authority, it will simply replace the anticipated value,
/// resulting in a "snap" to the new value if it is different from the anticipated value.</description></item>
///
/// <item><description><b>Smooth:</b> In this mode (with <see cref="StaleDataHandling"/> set to
/// <see cref="Netcode.StaleDataHandling.Ignore"/> and an <see cref="NetworkBehaviour.OnReanticipate"/> callback that calls
/// <see cref="StaleDataHandling.Ignore"/> and an <see cref="NetworkBehaviour.OnReanticipate"/> callback that calls
/// <see cref="Smooth"/> from the anticipated value to the authority value with an appropriate
/// <see cref="Mathf.Lerp"/>-style smooth function), when a more up-to-date value is received from the authority,
/// it will interpolate over time from an incorrect anticipated value to the correct authoritative value.</description></item>
///
/// <item><description><b>Constant Reanticipation:</b> In this mode (with <see cref="StaleDataHandling"/> set to
/// <see cref="Netcode.StaleDataHandling.Reanticipate"/> and an <see cref="NetworkBehaviour.OnReanticipate"/> that calculates a
/// <see cref="StaleDataHandling.Reanticipate"/> and an <see cref="NetworkBehaviour.OnReanticipate"/> that calculates a
/// new anticipated value based on the current authoritative value), when a more up-to-date value is received from
/// the authority, user code calculates a new anticipated value, possibly calling <see cref="Smooth"/> to interpolate
/// between the previous anticipation and the new anticipation. This is useful for values that change frequently and
Expand Down Expand Up @@ -85,11 +85,11 @@ public class AnticipatedNetworkVariable<T> : NetworkVariableBase
/// Defines what the behavior should be if we receive a value from the server with an earlier associated
/// time value than the anticipation time value.
/// <br/><br/>
/// If this is <see cref="Netcode.StaleDataHandling.Ignore"/>, the stale data will be ignored and the authoritative
/// If this is <see cref="StaleDataHandling.Ignore"/>, the stale data will be ignored and the authoritative
/// value will not replace the anticipated value until the anticipation time is reached. <see cref="OnAuthoritativeValueChanged"/>
/// and <see cref="NetworkBehaviour.OnReanticipate"/> will also not be invoked for this stale data.
/// <br/><br/>
/// If this is <see cref="Netcode.StaleDataHandling.Reanticipate"/>, the stale data will replace the anticipated data and
/// If this is <see cref="StaleDataHandling.Reanticipate"/>, the stale data will replace the anticipated data and
/// <see cref="OnAuthoritativeValueChanged"/> and <see cref="NetworkBehaviour.OnReanticipate"/> will be invoked.
/// In this case, the authoritativeTime value passed to <see cref="NetworkBehaviour.OnReanticipate"/> will be lower than
/// the anticipationTime value, and that callback can be used to calculate a new anticipated value.
Expand Down Expand Up @@ -229,7 +229,7 @@ public void Anticipate(T value)
/// Retrieves or sets the underlying authoritative value.
/// Note that only a client or server with write permissions to this variable may set this value.
/// When this variable has been anticipated, this value will alawys return the most recent authoritative
/// state, which is updated even if <see cref="StaleDataHandling"/> is <see cref="Netcode.StaleDataHandling.Ignore"/>.
/// state, which is updated even if <see cref="StaleDataHandling"/> is <see cref="StaleDataHandling.Ignore"/>.
/// </summary>
#pragma warning restore IDE0001
public T AuthoritativeValue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class SceneEvent
{
/// <summary>
/// The <see cref="UnityEngine.AsyncOperation"/> returned by <see cref="SceneManager"/><br />
/// This is set for the following <see cref="Netcode.SceneEventType"/>s:
/// This is set for the following <see cref="SceneEventType"/>s:
/// <list type="bullet">
/// <item><term><see cref="SceneEventType.Load"/></term></item>
/// <item><term><see cref="SceneEventType.Unload"/></term></item>
Expand All @@ -32,13 +32,13 @@ public class SceneEvent
public AsyncOperation AsyncOperation;

/// <summary>
/// Will always be set to the current <see cref="Netcode.SceneEventType"/>
/// Will always be set to the current <see cref="SceneEventType"/>
/// </summary>
public SceneEventType SceneEventType;

/// <summary>
/// If applicable, this reflects the type of scene loading or unloading that is occurring.<br />
/// This is set for the following <see cref="Netcode.SceneEventType"/>s:
/// This is set for the following <see cref="SceneEventType"/>s:
/// <list type="bullet">
/// <item><term><see cref="SceneEventType.Load"/></term></item>
/// <item><term><see cref="SceneEventType.Unload"/></term></item>
Expand All @@ -52,7 +52,7 @@ public class SceneEvent

/// <summary>
/// This will be set to the scene name that the event pertains to.<br />
/// This is set for the following <see cref="Netcode.SceneEventType"/>s:
/// This is set for the following <see cref="SceneEventType"/>s:
/// <list type="bullet">
/// <item><term><see cref="SceneEventType.Load"/></term></item>
/// <item><term><see cref="SceneEventType.Unload"/></term></item>
Expand All @@ -66,7 +66,7 @@ public class SceneEvent

/// <summary>
/// This will be set to the path to the scene that the event pertains to.<br />
/// This is set for the following <see cref="Netcode.SceneEventType"/>s:
/// This is set for the following <see cref="SceneEventType"/>s:
/// <list type="bullet">
/// <item><term><see cref="SceneEventType.Load"/></term></item>
/// <item><term><see cref="SceneEventType.Unload"/></term></item>
Expand All @@ -80,7 +80,7 @@ public class SceneEvent

/// <summary>
/// When a scene is loaded, the Scene structure is returned.<br />
/// This is set for the following <see cref="Netcode.SceneEventType"/>s:
/// This is set for the following <see cref="SceneEventType"/>s:
/// <list type="bullet">
/// <item><term><see cref="SceneEventType.LoadComplete"/></term></item>
/// </list>
Expand All @@ -90,7 +90,7 @@ public class SceneEvent
/// <summary>
/// The client identifier can vary depending upon the following conditions: <br />
/// <list type="number">
/// <item><term><see cref="Netcode.SceneEventType"/>s that always set the <see cref="ClientId"/>
/// <item><term><see cref="SceneEventType"/>s that always set the <see cref="ClientId"/>
/// to the local client identifier, are initiated (and processed locally) by the
/// server-host, and sent to all clients to be processed.<br />
/// <list type="bullet">
Expand Down Expand Up @@ -122,7 +122,7 @@ public class SceneEvent

/// <summary>
/// List of clients that completed a loading or unloading event.<br />
/// This is set for the following <see cref="Netcode.SceneEventType"/>s:
/// This is set for the following <see cref="SceneEventType"/>s:
/// <list type="bullet">
/// <item><term><see cref="SceneEventType.LoadEventCompleted"/></term></item>
/// <item><term><see cref="SceneEventType.UnloadEventCompleted"/></term></item>
Expand All @@ -132,7 +132,7 @@ public class SceneEvent

/// <summary>
/// List of clients that timed out during a loading or unloading event.<br />
/// This is set for the following <see cref="Netcode.SceneEventType"/>s:
/// This is set for the following <see cref="SceneEventType"/>s:
/// <list type="bullet">
/// <item><term><see cref="SceneEventType.LoadEventCompleted"/></term></item>
/// <item><term><see cref="SceneEventType.UnloadEventCompleted"/></term></item>
Expand Down Expand Up @@ -824,7 +824,7 @@ public void SetClientSynchronizationMode(LoadSceneMode mode)
/// <summary>
/// Constructor
/// </summary>
/// <param name="networkManager">one <see cref="Netcode.NetworkManager"/> instance per <see cref="NetworkSceneManager"/> instance</param>
/// <param name="networkManager">one <see cref="NetworkManager"/> instance per <see cref="NetworkSceneManager"/> instance</param>
/// <param name="sceneEventDataPoolSize">maximum <see cref="SceneEventData"/> pool size</param>
internal NetworkSceneManager(NetworkManager networkManager)
{
Expand Down Expand Up @@ -2693,7 +2693,7 @@ internal void HandleSceneEvent(ulong clientId, FastBufferReader reader)
}
else
{
Debug.LogError($"{nameof(HandleSceneEvent)} was invoked but {nameof(Netcode.NetworkManager)} reference was null!");
Debug.LogError($"{nameof(HandleSceneEvent)} was invoked but {nameof(NetworkManager)} reference was null!");
}
}

Expand Down
Loading
Loading