コード例 #1
0
        public void Setup()
        {
            TestResourcesEditorSettingsData settings = TestResourcesEditorSettings.Settings.GetData();

            if (settings.BuildBeforeTestRun)
            {
                TestResourcesEditorUtility.BuildAssetBundle();
            }
        }
コード例 #2
0
        public void Cleanup()
        {
            TestResourcesEditorSettingsData settings = TestResourcesEditorSettings.Settings.GetData();

            if (settings.ClearAfterTestRun)
            {
                TestResourcesEditorUtility.ClearAssetBundle();
            }
        }
        public override void OnInspectorGUI()
        {
            using (new SerializedObjectUpdateScope(serializedObject))
            {
                EditorGUILayout.PropertyField(m_propertyBuildBeforeTestRun);
                EditorGUILayout.PropertyField(m_propertyClearAfterTestRun);
                EditorGUILayout.PropertyField(m_propertyAssetBundleName);
                EditorGUILayout.PropertyField(m_propertyAssetBundleOptions);
                EditorGUILayout.PropertyField(m_propertyAssetBundleOutputDirectory);
                EditorGUILayout.PropertyField(m_propertyAssetBundleOutputPath);

                m_listFolders.DrawGUILayout();
            }

            EditorGUILayout.Space();

            bool exists = TestResourcesEditorUtility.IsAssetBundleExists();

            using (new EditorGUILayout.HorizontalScope())
            {
                GUILayout.FlexibleSpace();

                if (GUILayout.Toggle(m_displayAssetBundleInfo, "Display AssetBundle Information") != m_displayAssetBundleInfo)
                {
                    m_displayAssetBundleInfo = !m_displayAssetBundleInfo;

                    UpdateAssetBundleDrawer();
                }

                EditorGUILayout.Space();

                using (new EditorGUI.DisabledScope(!exists))
                {
                    if (GUILayout.Button("Clear", GUILayout.Width(75F)))
                    {
                        TestResourcesEditorUtility.ClearAssetBundle();
                        AssetDatabase.Refresh();

                        UpdateAssetBundleDrawer();
                    }
                }

                using (new EditorGUI.DisabledScope(m_listFolders.SerializedProperty.arraySize == 0))
                {
                    if (GUILayout.Button("Build", GUILayout.Width(75F)))
                    {
                        TestResourcesEditorUtility.BuildAssetBundle();
                        AssetDatabase.Refresh();

                        UpdateAssetBundleDrawer();
                    }
                }

                EditorGUILayout.Space();
            }

            EditorGUILayout.Space();

            if (m_displayAssetBundleInfo)
            {
                if (m_assetBundleDrawer.HasData)
                {
                    m_assetBundleDrawer.DrawGUILayout();
                }
                else
                {
                    EditorGUILayout.HelpBox("No AssetBundle information available, build required.", MessageType.Info);
                }
            }
        }