首次提交
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
using UnityEditor;
|
||||
|
||||
namespace Ilumisoft.GraphicsControl.Editor
|
||||
{
|
||||
[CustomEditor(typeof(GraphicSetting), true)]
|
||||
public class GraphicSettingEditor : UnityEditor.Editor
|
||||
{
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
serializedObject.Update();
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
|
||||
DrawPropertiesExcluding(serializedObject, "m_Script");
|
||||
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f87684af450126c44896e4b52fbd408e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,19 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ilumisoft.GraphicsControl.Editor
|
||||
{
|
||||
class GraphicsCotnrolSettingsProvider
|
||||
{
|
||||
[SettingsProvider]
|
||||
public static SettingsProvider CreateStartupProfileConfigurationProvider() => CreateProvider("Project/Graphics Control", Configuration.Find());
|
||||
|
||||
static SettingsProvider CreateProvider(string settingsWindowPath, Object asset)
|
||||
{
|
||||
var provider = AssetSettingsProvider.CreateProviderFromObject(settingsWindowPath, asset);
|
||||
|
||||
provider.keywords = SettingsProvider.GetSearchKeywordsFromSerializedObject(new SerializedObject(asset));
|
||||
return provider;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7039f079b3dfc6b45b850a93d88857a9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "Ilumisoft.GraphicsControl.Editor",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:7f595fd175e67274183d17fac15b74c9"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e85b0f2ab2cb4fd4396d9ce383d836d9
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,36 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ilumisoft.GraphicsControl.Editor
|
||||
{
|
||||
public static class MenuItems
|
||||
{
|
||||
// Add a menu item to create custom GameObjects.
|
||||
// Priority 1 ensures it is grouped with the other menu items of the same kind
|
||||
// and propagated to the hierarchy dropdown and hierarchy context menus.
|
||||
[MenuItem("GameObject/UI/Graphic Settings Panel", false, 10)]
|
||||
static void CreateCustomGameObject(MenuCommand menuCommand)
|
||||
{
|
||||
Configuration configuration = Configuration.Find();
|
||||
|
||||
if(configuration.GraphicSettingsPanel == null)
|
||||
{
|
||||
Debug.LogWarning("Could not create Graphic Settings Panel, because no prefab has been assigned in the project settings.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Create a custom game object
|
||||
GameObject go = PrefabUtility.InstantiatePrefab(configuration.GraphicSettingsPanel) as GameObject;// new GameObject("Graphic Settings Panel");
|
||||
|
||||
go.name = "Graphic Settings Panel";
|
||||
|
||||
// Ensure it gets reparented if this was a context click (otherwise does nothing)
|
||||
GameObjectUtility.SetParentAndAlign(go, menuCommand.context as GameObject);
|
||||
|
||||
// Register the creation in the undo system
|
||||
Undo.RegisterCreatedObjectUndo(go, "Create " + go.name);
|
||||
|
||||
Selection.activeObject = go;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a00eef7e69de0bd46a508e735bcde211
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user