UnityEditor.ShaderUtil.AddNewShaderToCollection C# (CSharp) Method

AddNewShaderToCollection() private method

private AddNewShaderToCollection ( Shader shader, ShaderVariantCollection collection ) : bool
shader UnityEngine.Shader
collection UnityEngine.ShaderVariantCollection
return bool
        internal static extern bool AddNewShaderToCollection(Shader shader, ShaderVariantCollection collection);
        [MethodImpl(MethodImplOptions.InternalCall)]

Usage Example

示例#1
0
 public override void OnInspectorGUI()
 {
     base.serializedObject.Update();
     for (int i = 0; i < this.m_Shaders.arraySize; i++)
     {
         this.DrawShaderEntry(i);
     }
     if (GUILayout.Button("Add shader", new GUILayoutOption[0]))
     {
         ObjectSelector.get.Show(null, typeof(Shader), null, false);
         ObjectSelector.get.objectSelectorID = "ShaderVariantSelector".GetHashCode();
         GUIUtility.ExitGUI();
     }
     if (Event.current.type == EventType.ExecuteCommand)
     {
         if (Event.current.commandName == "ObjectSelectorClosed" && ObjectSelector.get.objectSelectorID == "ShaderVariantSelector".GetHashCode())
         {
             Shader shader = ObjectSelector.GetCurrentObject() as Shader;
             if (shader != null)
             {
                 ShaderUtil.AddNewShaderToCollection(shader, base.target as ShaderVariantCollection);
             }
             Event.current.Use();
             GUIUtility.ExitGUI();
         }
     }
     base.serializedObject.ApplyModifiedProperties();
 }
All Usage Examples Of UnityEditor.ShaderUtil::AddNewShaderToCollection