Legacy Documentation: Version 4.5.0

Script language:

  • JS
  • C#
  • Boo
Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

MaterialEditor

Namespace: UnityEditor

/

Inherits from: Editor

Description

The Unity Material Editor.

Extend this class to write your own custom material editor. For more detailed information see the Custom Material Editor section of the the ShaderLab reference.

Variables

isVisibleIs the current material expanded.

Functions

AwakeCalled when the Editor is woken up.
ColorPropertyDraw a property field for a color shader property.
DefaultShaderPropertyHandles UI for one shader property ignoring any custom drawers.
FloatPropertyDraw a property field for a float shader property.
GetPropertyHeightCalculate height needed for the property.
OnDisableCalled when the editor is disabled, if overridden please call the base OnDisable() to ensure that the material inspector is set up properly.
OnEnableCalled when the editor is enabled, if overridden please call the base OnEnable() to ensure that the material inspector is set up properly.
OnInspectorGUIImplement specific MaterialEditor GUI code here. If you want to simply extend the existing editor call the base OnInspectorGUI () before doing any custom GUI code.
PropertiesChangedWhenever a material property is changed call this function. This will rebuild the inspector and validate the properties.
PropertiesGUIRender the standard material properties.
RangePropertyDraw a range slider for a range shader property.
RegisterPropertyChangeUndoCall this when you change a material property. It will add an undo for the action.
SetShaderSet the shader of the material.
ShaderPropertyHandes UI for one shader property.
TexturePropertyDraw a property field for a texture shader property.
VectorPropertyDraw a property field for a vector shader property.

Static Functions

ApplyMaterialPropertyDrawersApply initial MaterialPropertyDrawer values.
GetDefaultPropertyHeightCalculate height needed for the property, ignoring custom drawers.
GetMaterialPropertiesGet shader property information of the passed materials.
GetMaterialPropertyGet information about a single shader property.

Inherited members

Variables

serializedObjectA SerializedObject representing the object or objects being inspected.
targetThe object being inspected.
targetsAn array of all the object being inspected.
hideFlagsShould the object be hidden, saved with the scene or modifiable by the user?
nameThe name of the object.

Functions

DrawDefaultInspectorDraw the built-in inspector.
DrawHeaderCall this function to draw the header of the editor.
DrawPreviewThe first entry point for Preview Drawing.
GetInfoStringImplement this method to show asset information on top of the asset preview.
GetPreviewTitleOverride this method if you want to change the label of the Preview area.
HasPreviewGUIOverride this method in subclasses if you implement OnPreviewGUI.
OnInspectorGUIImplement this function to make a custom inspector.
OnInteractivePreviewGUIImplement to create your own interactive custom preview. Interactive custom previews are used in the preview area of the inspector and the object selector.
OnPreviewGUIImplement to create your own custom preview for the preview area of the inspector, primary editor headers and the object selector.
OnPreviewSettingsOverride this method if you want to show custom controls in the preview header.
RenderStaticPreviewOverride this method if you want to render a static preview that shows.
RepaintRepaint any inspectors that shows this editor.
UseDefaultMarginsOverride this method in subclasses to return false if you don't want default margins.
GetInstanceIDReturns the instance id of the object.
ToStringReturns the name of the game object.

Static Functions

CreateEditorMake a custom editor for obj or objects.
DestroyRemoves a gameobject, component or asset.
DestroyImmediateDestroys the object obj immediately. You are strongly recommended to use Destroy instead.
DontDestroyOnLoadMakes the object target not be destroyed automatically when loading a new scene.
FindObjectOfTypeReturns the first active loaded object of Type type.
FindObjectsOfTypeReturns a list of all active loaded objects of Type type.
InstantiateClones the object original and returns the clone.
CreateInstanceCreates an instance of a scriptable object with className.

Operators

boolDoes the object exist?
operator !=Compares if two objects refer to a different object.
operator ==Compares if two objects refer to the same.

Messages

OnSceneGUILets the Editor handle an event in the scene view.
OnDestroyThis function is called when the scriptable object will be destroyed.
OnDisableThis function is called when the scriptable object goes out of scope.
OnEnableThis function is called when the object is loaded.