protected override void BeginUpdatingFrame(NetworkConnectionDelta connectionDelta) { base.BeginUpdatingFrame(connectionDelta); // Messages for hierarchies need to be sent from root to leaf to ensure // that Canvas construction on the other end happens in the correct order. CachedParentTransform?.OnFrameCompleted(connectionDelta); }
/// <summary> /// Returns true if the provided connection should receive a transform update, otherwise false /// </summary> /// <param name="connection">network connection to potentially send transform update</param> /// <returns>True if the provided connection should receive a transform update, otherwise false</returns> public bool ShouldSendTransformInHierarchy(INetworkConnection connection) { if (isParentTransformReportingFlagValid) { StateSynchronizationPerformanceMonitor.Instance.IncrementEventCount(PerformanceComponentName, "ShouldSendTransformInHierarchy.UsedCache"); return(cachedParentTransformReportingFlag); } if (BlockedConnections.Contains(connection)) { StateSynchronizationPerformanceMonitor.Instance.IncrementEventCount(PerformanceComponentName, "BlockedConnection"); return(false); } if (IsHidden) { return(false); } if (CachedParentTransform != null) { cachedParentTransformReportingFlag = CachedParentTransform.ShouldSendTransformInHierarchy(connection); isParentTransformReportingFlagValid = true; StateSynchronizationPerformanceMonitor.Instance.IncrementEventCount(PerformanceComponentName, "ShouldSendTransformInHierarchy.LookupParent"); return(cachedParentTransformReportingFlag); } else { return(true); } }
private void EnsureIDAndParentTransformInitialized() { if (!isIdInitialized) { transformBroadcaster = this; id = StateSynchronizationSceneManager.Instance.GetNewTransformId(); StateSynchronizationSceneManager.Instance.AssignMirror(this.CachedGameObject, this.id); AttachTransformBroadcasterControllers(); if (CachedParentTransform != null) { CachedParentTransform.EnsureIDAndParentTransformInitialized(); } isIdInitialized = true; } }
/// <summary> /// Returns true if the provided endpoint should receive a transform update, otherwise false /// </summary> /// <param name="endpoint">network connection to potentially send transform update</param> /// <returns>True if the provided endpoint should receive a transform update, otherwise false</returns> public bool ShouldSendTransformInHierarchy(SocketEndpoint endpoint) { if (BlockedConnections.Contains(endpoint)) { return(false); } if (IsHidden) { return(false); } if (CachedParentTransform != null) { return(CachedParentTransform.ShouldSendTransformInHierarchy(endpoint)); } else { return(true); } }