Esempio n. 1
0
        public override void Awake()
        {
            base.Awake();

            titleContent = new GUIContent("Asset Preview", "");
            m_Object     = RichNativeObject.invalid;
        }
Esempio n. 2
0
            public void Initialize(RootPathControl owner, PackedMemorySnapshot snapshot, PackedNativeUnityEngineObject nativeObject)
            {
                m_Owner        = owner;
                m_Snapshot     = snapshot;
                m_NativeObject = new RichNativeObject(snapshot, nativeObject.nativeObjectsArrayIndex);

                m_Value     = m_NativeObject.name;
                m_Address   = m_NativeObject.address;
                displayName = m_NativeObject.type.name;

                // If it's a MonoBehaviour or ScriptableObject, use the C# typename instead
                // It makes it easier to understand what it is, otherwise everything displays 'MonoBehaviour' only.
                // TODO: Move to separate method
                if (m_NativeObject.type.IsSubclassOf(m_Snapshot.coreTypes.nativeMonoBehaviour) || m_NativeObject.type.IsSubclassOf(m_Snapshot.coreTypes.nativeScriptableObject))
                {
                    string monoScriptName;
                    if (m_Snapshot.FindNativeMonoScriptType(m_NativeObject.packed.nativeObjectsArrayIndex, out monoScriptName) != -1)
                    {
                        if (!string.IsNullOrEmpty(monoScriptName))
                        {
                            displayName = monoScriptName;
                        }
                    }
                }
            }
Esempio n. 3
0
            public void Initialize(NativeObjectsControl owner, PackedNativeUnityEngineObject nativeObject)
            {
                m_Owner  = owner;
                m_Object = new RichNativeObject(owner.m_Snapshot, nativeObject.nativeObjectsArrayIndex);
#if HEAPEXPLORER_DISPLAY_REFS
                m_Object.GetConnectionsCount(out m_ReferencesCount, out m_ReferencedByCount);
#endif
            }
Esempio n. 4
0
        public void Inspect(PackedNativeUnityEngineObject obj)
        {
            Clear();

            m_PreviewTime = Time.realtimeSinceStartup;
            m_Object      = new RichNativeObject(snapshot, obj.nativeObjectsArrayIndex);

            if (autoLoad && m_Object.isValid && m_Object.isPersistent)
            {
                LoadAssetPreviews();
            }
        }
Esempio n. 5
0
        public void Clear()
        {
            if (m_Editor != null)
            {
                Editor.DestroyImmediate(m_Editor);
                m_Editor = null;
            }

            m_Object           = RichNativeObject.invalid;
            m_HasPreviewAssets = false;
            m_LoadedAssets     = new List <Object>();
            m_Guids            = new List <string>();
            m_LoadPreview      = false;
        }
Esempio n. 6
0
        public override void OnDestroy()
        {
            base.OnDestroy();

            if (m_Editor != null)
            {
                Editor.DestroyImmediate(m_Editor);
                m_Editor = null;
            }

            m_Guids        = new List <string>();
            m_LoadedAssets = new List <Object>();
            m_Object       = RichNativeObject.invalid;
        }
Esempio n. 7
0
        void ExportNativeObjects(string filePath)
        {
            var sb   = new System.Text.StringBuilder(1024 * 16);
            var objs = snapshot.nativeObjects;

            sb.AppendFormat("\"{1}\"{0}\"{2}\"{0}\"{3}\"{0}\"{4}\"{0}\"{5}\"{0}\"{6}\"{0}\"{7}\"{0}\"{8}\"{0}\"{9}\"{0}\"{10}\"\n",
                            m_Delimiter,
                            "C++ Type",
                            "C++ Name",
                            "Bytes",
                            "DontDestroyOnLoad",
                            "Persistent",
                            "Address",
                            "InstanceId",
                            "Manager",
                            "HideFlags",
                            "C# Type");

            for (var n = 0; n < objs.Length; ++n)
            {
                var obj = new RichNativeObject(snapshot, objs[n].nativeObjectsArrayIndex);
                sb.AppendFormat("\"{1}\"{0}\"{2}\"{0}\"{3}\"{0}\"{4}\"{0}\"{5}\"{0}\"{6}\"{0}\"{7}\"{0}\"{8}\"{0}\"{9}\"{0}\"{10}\"\n",
                                m_Delimiter,
                                obj.type.name,
                                obj.name,
                                obj.size,
                                obj.isDontDestroyOnLoad,
                                obj.isPersistent,
                                obj.address,
                                obj.instanceId,
                                obj.isManager,
                                obj.hideFlags,
                                obj.managedObject.type.name);
            }

            System.IO.File.WriteAllText(filePath, sb.ToString(), System.Text.Encoding.UTF8);
        }
Esempio n. 8
0
 public GotoCommand(RichNativeObject value)
     : this()
 {
     toNativeObject = value;
 }
Esempio n. 9
0
 public ObjectProxy(PackedMemorySnapshot snp, PackedNativeUnityEngineObject packed)
 {
     snapshot = snp;
     native   = new RichNativeObject(snp, packed.nativeObjectsArrayIndex);
 }