PUN Classic (v1)、PUN 2 和 Bolt 處於維護模式。 PUN 2 將支援 Unity 2019 至 2022,但不會添加新功能。 當然,您所有的 PUN & Bolt 專案可以用已知性能繼續運行使用。 對於任何即將開始或新的專案:請切換到 Photon Fusion 或 Quantum。

Overriding Bolt Logging

You can override Bolt’s internal logging and add your own implementation. First you implement BoltLog.IWriter:

C#

/**
 * The interface providing log writing capabilities to an output
 */
public interface IWriter : IDisposable
{
  void Debug(string message);
  void Error(string message);
  void Info(string message);
  void Warn(string message);
}

Example of implementation:

C#

// MyLogger.cs
using Bolt;

public class MyLogger : BoltLog.IWriter
{
    public void Debug(string message) { /* log code */ }
    public void Error(string message) { /* log code */ }
    public void Info(string message) { /* log code */ }
    public void Warn(string message) { /* log code */ }
    public void Dispose() {}
}

And then you add it to Bolt at runtime with BoltLog.Add:

C#

public override void BoltStartDone()
{
    BoltLog.Add(new MyLogger());
}

At this point you can turn off the options for Bolt logging in the Bolt settings and then you control the logging of Bolt yourself.

Back to top