docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct NetDebug

    Singleton handling NetCode logging and log management.

    Implements
    IComponentData
    IQueryTypeParameter
    Inherited Members
    ValueType.Equals(object)
    ValueType.GetHashCode()
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: Unity.NetCode
    Assembly: Unity.NetCode.dll
    Syntax
    public struct NetDebug : IComponentData, IQueryTypeParameter

    Fields

    WarnAboveAverageBatchedTicksPerFrame

    Display a warning if the average number if ticks per frame is above this number

    Declaration
    public float WarnAboveAverageBatchedTicksPerFrame
    Field Value
    Type Description
    float

    WarnBatchedTicks

    Display a warning if ticks have been bacthed

    Declaration
    public bool WarnBatchedTicks
    Field Value
    Type Description
    bool
    Remarks

    Warning will be displayed when frame time has exceeded the ability for fixed updates to 'catch up' to the simulation time, ticks will be batched so instead of n ticks of fixedTimer per frame, we will have m ticks of (n/m)*fixedTime per frame While this allows the simulation to catch-up it degrades interpolation performance and can introduce predition errors since the server will simulate fewer frames than a client will predict and they may need to be adjusted. This can be common in the editor and situations of poor performance. With good interpolation and infrequent ocurrances this should have minimal visual impact. If its happening every frame you will observe severly degraded performance

    WarnBatchedTicksRollingWindowSize

    Size of the rolling window used to calculate the avergage for the number of frames which contained tick batching.

    Declaration
    public int WarnBatchedTicksRollingWindowSize
    Field Value
    Type Description
    int

    Properties

    LogLevel

    The current debug logging level. Default value is Notify.

    Declaration
    [ExcludeFromBurstCompatTesting("may use managed objects")]
    public NetDebug.LogLevelType LogLevel { get; set; }
    Property Value
    Type Description
    NetDebug.LogLevelType

    MaxRpcAgeFrames

    A NetCode RPC will trigger a warning if it hasn't been consumed or destroyed (which is a proxy for 'handled') after this many simulation frames (inclusive). Age. Set to 0 to opt out.

    Declaration
    public ushort MaxRpcAgeFrames { readonly get; set; }
    Property Value
    Type Description
    ushort

    SuppressApplicationRunInBackgroundWarning

    If you disable UnityEngine.Application.runInBackground, users will experience client disconnects when tabbing out of (or otherwise un-focusing) your game application. It is therefore highly recommended to enable "Run in "Background" via ticking Project Settings... Player... Resolution and Presentation... Run In Background.

    Declaration
    public bool SuppressApplicationRunInBackgroundWarning { readonly get; set; }
    Property Value
    Type Description
    bool
    Remarks

    Setting SuppressApplicationRunInBackgroundWarning to true will allow you to toggle off "Run in Background" without triggering the advice log.

    SuppressApprovalRpcSentWhenApprovalFlowDisabledWarning

    When debugging, it's helpful to treat 'sending an IApprovalRpcCommand RPC when approval is disabled' as a warning. However, you may use approval RPCs to also send match join information, thus you may wish to suppress this warning. Do so by setting this to true. This log suppression is enabled by default! Set this flag to false to see the warning.

    Declaration
    public bool SuppressApprovalRpcSentWhenApprovalFlowDisabledWarning { readonly get; set; }
    Property Value
    Type Description
    bool

    Methods

    DebugLog(in FixedString512Bytes)

    Print the log message with Debug level priority;

    Declaration
    public readonly void DebugLog(in FixedString512Bytes msg)
    Parameters
    Type Name Description
    FixedString512Bytes msg

    The ascii message string. Unicode are not supported

    Dispose()

    Destroy the internal resources allocated by the debug logger and flush any pending messages.

    Declaration
    public void Dispose()

    Log(in FixedString512Bytes)

    Print a log message with Notify level priority;

    Declaration
    public readonly void Log(in FixedString512Bytes msg)
    Parameters
    Type Name Description
    FixedString512Bytes msg

    The ascii message string. Unicode are not supported

    LogError(in FixedString512Bytes)

    Print a log message with error priority

    Declaration
    public readonly void LogError(in FixedString512Bytes msg)
    Parameters
    Type Name Description
    FixedString512Bytes msg

    The ascii message string. Unicode are not supported

    LogFolderForPlatform()

    Use this method to retrieve the platform specific folder where the NetCode logs files will be stored. On Desktop it use the UnityEngine.Application.consoleLogPath is used. For mobile, the UnityEngine.Application.persistentDataPath is used. For DOTS Runtime builds, it is possible to customise the output by using the -logfile command line switch.

    In all cases, if the log path is null or empty, the Logs folder in the current directory is used instead.

    Declaration
    public static string LogFolderForPlatform()
    Returns
    Type Description
    string

    A string containg the log folder full path

    LogWarning(in FixedString512Bytes)

    Print a log message with warning priority

    Declaration
    public readonly void LogWarning(in FixedString512Bytes msg)
    Parameters
    Type Name Description
    FixedString512Bytes msg

    The ascii message string. Unicode are not supported

    PrintHex(uint)

    Print an unsigned integer in hexadecimal format

    Declaration
    public static FixedString32Bytes PrintHex(uint value)
    Parameters
    Type Name Description
    uint value

    The unsigned value to convert

    Returns
    Type Description
    FixedString32Bytes

    An unsigned integer in hexadecimal format

    PrintHex(ulong)

    Print a unsigned long integer in hexadecimal format

    Declaration
    public static FixedString32Bytes PrintHex(ulong value)
    Parameters
    Type Name Description
    ulong value

    The unsigned value to convert

    Returns
    Type Description
    FixedString32Bytes

    a unsigned long integer in hexadecimal format

    Implements

    Unity.Entities.IComponentData
    Unity.Entities.IQueryTypeParameter
    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)