Пример #1
0
    // If no other monobehaviour request the instance in an awake function
    // executing before this one, no need to search the object.
    private void Awake()
    {
        if (m_Instance == null)
        {
#if DEBUG_SINGLETONS
            Debug.Log(typeof(T).ToString() + ": A New Instance Awakens!");
#endif
            m_Instance = this as T;

            DontDestroyOnLoad(m_Instance);
            m_Instance.Init();
        }
        else
        {
            Destroy(gameObject);
        }

#if DEBUG_LOADING
        Debug.Log("Instance Awoken" + typeof(T).ToString() + " ++++++Awake");

#if UNITY_EDITOR
        Debug.Log("MEMMEMMEM:: MonoHeap: (" + ((float)Profiler.GetMonoHeapSize() / (1048576f)).ToString("0.000") + "MB) MonoUsed: (" + ((float)Profiler.GetMonoUsedSize() / (1048576f)).ToString("0.000") + "MB) TotAlloc: (" + ((float)Profiler.GetTotalAllocatedMemory() / (1048576f)).ToString("0.000") + "MB) TotReserved: (" + ((float)Profiler.GetTotalReservedMemory() / (1048576f)).ToString("0.000") + "MB) TotUnusedRes: (" + ((float)Profiler.GetTotalUnusedReservedMemory() / (1048576f)).ToString("0.000") + "MB)");
#elif UNITY_PS3
        Debug.Log("MEMMEMMEM:: MonoHeap: (" + ((float)Profiler.GetMonoHeapSize() / (1048576f)).ToString("0.000") + "MB) MonoUsed: (" + ((float)Profiler.GetMonoUsedSize() / (1048576f)).ToString("0.000") + "MB) TotAlloc: (" + ((float)Profiler.GetTotalAllocatedMemory() / (1048576f)).ToString("0.000") + "MB) TotReserved: (" + ((float)Profiler.GetTotalReservedMemory() / (1048576f)).ToString("0.000") + "MB) TotUnusedRes: (" + ((float)Profiler.GetTotalUnusedReservedMemory() / (1048576f)).ToString("0.000") + "MB) FreeSystemMem: (" + ((float)PS3SystemUtility.GetFreeSystemMem() / (1048576f)).ToString("0.000") + "MB)");
#endif
#endif
    }
Пример #2
0
    public void DebugLogMemory(string strAdditional)
    {
#if UNITY_EDITOR
        Debug.Log("MEMMEMMEM:: " + strAdditional + " MonoHeap: (" + ((float)Profiler.GetMonoHeapSize() / (1048576f)).ToString("0.000") + "MB) MonoUsed: (" + ((float)Profiler.GetMonoUsedSize() / (1048576f)).ToString("0.000") + "MB) TotAlloc: (" + ((float)Profiler.GetTotalAllocatedMemory() / (1048576f)).ToString("0.000") + "MB) TotReserved: (" + ((float)Profiler.GetTotalReservedMemory() / (1048576f)).ToString("0.000") + "MB) TotUnusedRes: (" + ((float)Profiler.GetTotalUnusedReservedMemory() / (1048576f)).ToString("0.000") + "MB)");
#elif UNITY_PS3
        Debug.Log("MEMMEMMEM:: " + strAdditional + " MonoHeap: (" + ((float)Profiler.GetMonoHeapSize() / (1048576f)).ToString("0.000") + "MB) MonoUsed: (" + ((float)Profiler.GetMonoUsedSize() / (1048576f)).ToString("0.000") + "MB) TotAlloc: (" + ((float)Profiler.GetTotalAllocatedMemory() / (1048576f)).ToString("0.000") + "MB) TotReserved: (" + ((float)Profiler.GetTotalReservedMemory() / (1048576f)).ToString("0.000") + "MB) TotUnusedRes: (" + ((float)Profiler.GetTotalUnusedReservedMemory() / (1048576f)).ToString("0.000") + "MB) FreeSystemMem: (" + ((float)PS3SystemUtility.GetFreeSystemMem() / (1048576f)).ToString("0.000") + "MB)");
#endif
    }