zoukankan      html  css  js  c++  java
  • 封装Unity3d的dll时的经验总结

    部分时候,我们需要自己封装一些小工具来简化我们的工作。

    实验时,偶然发现Unity3d的console在双击进行debug信息的输出定位时,只能跟进到dll的上一层,因此我们可以将unity3d自带的Debug进行封装,以方便我们在游戏发布时对log信息的屏蔽。

    代码如下:

    using UnityEngine;

    public class MyDebug
    {
      public static bool m_bStartTest = true; 

      public static void Log(object message)
      {
        if (m_bStartTest)
          Debug.Log(message);
      }
      public static void Log(object message1, Object message2)
      {
        if (m_bStartTest)
          Debug.Log(message1, message2);
      }

      public static void LogError(object message)
      {
        if (m_bStartTest)
          Debug.LogError(message);
      }
      public static void LogError(object message1, Object message2)
      {
        if (m_bStartTest)
          Debug.LogError(message1, message2);
      }

      public static void LogWarning(object message)
      {
        if (m_bStartTest)
          Debug.LogWarning(message);
      }
      public static void LogWarning(object message1, Object message2)
      {
        if (m_bStartTest)
          Debug.LogWarning(message1, message2);
      }

    }
    在编译为unity3d项目可以使用的dll时,要注意unity3d的.Net版本,不要高于3.5。

  • 相关阅读:
    RDD的基本命令
    python 数据类型
    RDD基础
    sql优化
    python文件操作
    Python之xlsx文件与csv文件相互转换
    ValueError: Some of types cannot be determined by the first 100 rows, please try again with sampling
    python
    python操作dataFrame
    python 列表,元祖,字典
  • 原文地址:https://www.cnblogs.com/wayland/p/4031835.html
Copyright © 2011-2022 走看看