Version: 2022.3
언어: 한국어

MaterialEditor

class in UnityEditor

/

다음으로부터 상속:Editor

매뉴얼로 전환

설명

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 ShaderLab reference.

정적 변수

kMiniTextureFieldLabelIndentLevelUseful for indenting shader properties that need the same indent as mini texture field.

변수

customShaderGUIReturns the custom ShaderGUI implemented by the shader.
isVisibleIs the current material expanded.

Public 함수

AwakeCalled when the Editor is woken up.
BeginAnimatedCheckCreates a Property wrapper, useful for making regular GUI controls work with MaterialProperty.
ColorPropertyDraw a property field for a color shader property.
DefaultPreviewGUIDefault handling of preview area for materials.
DefaultPreviewSettingsGUIDefault toolbar for material preview area.
DefaultShaderPropertyHandles UI for one shader property ignoring any custom drawers.
DoubleSidedGIFieldDisplay UI for editing a material's Double Sided Global Illumination setting. Returns true if the UI is indeed displayed i.e. the material supports the Double Sided Global Illumination setting. +See Also: Material.doubleSidedGI.
EmissionEnabledPropertyThis function will draw the UI for controlling whether emission is enabled or not on a material.
EnableInstancingFieldDisplay UI for editing material's render queue setting.
EndAnimatedCheckEnds a Property wrapper started with BeginAnimatedCheck.
FloatPropertyDraw a property field for a float shader property.
GetPropertyHeightCalculate height needed for the property.
GetTexturePropertyCustomAreaReturns the free rect below the label and before the large thumb object field. Is used for e.g. tiling and offset properties.
HasPreviewGUICan this component be Previewed in its current state?
HelpBoxWithButtonMake a help box with a message and button. Returns true, if button was pressed.
IntegerPropertyDraw a property field for an integer shader property.
IsInstancingEnabledDetermines whether the Enable Instancing checkbox is checked.
LightmapEmissionFlagsPropertyDraws the UI for setting the global illumination flag of a material.
LightmapEmissionPropertyThis function will draw the UI for the lightmap emission property. (None, Realtime, baked)See Also: MaterialLightmapFlags.
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.
OnPreviewGUICustom preview for Image component.
PropertiesChangedWhenever a material property is changed call this function. This will rebuild the inspector and validate the properties.
PropertiesDefaultGUIDefault rendering of shader properties.
PropertiesGUIRender the standard material properties. This method will either render properties using a ShaderGUI instance if found otherwise it uses PropertiesDefaultGUI.
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.
RenderQueueFieldDisplay UI for editing material's render queue setting.
RequiresConstantRepaintDoes this edit require to be repainted constantly in its current state?
SetDefaultGUIWidthsSet EditorGUIUtility.fieldWidth and labelWidth to the default values that PropertiesGUI uses.
SetShaderSet the shader of the material.
ShaderPropertyHandes UI for one shader property.
TextureCompatibilityWarningChecks if particular property has incorrect type of texture specified by the material, displays appropriate warning and suggests the user to automatically fix the problem.
TexturePropertyDraw a property field for a texture shader property.
TexturePropertyMiniThumbnailDraw a property field for a texture shader property that only takes up a single line height.
TexturePropertySingleLineMethod for showing a texture property control with additional inlined properites.
TexturePropertyTwoLinesMethod for showing a compact layout of properties.
TexturePropertyWithHDRColorMethod for showing a texture property control with a HDR color field and its color brightness float field.
TextureScaleOffsetPropertyDraws tiling and offset properties for a texture.
VectorPropertyDraw a property field for a vector shader property.

보호되는 함수

OnShaderChangedA callback that is invoked when a Material's Shader is changed in the Inspector.

정적 함수

ApplyMaterialPropertyDrawersApply initial MaterialPropertyDrawer values.
BeginPropertyCreates a wrapper enabling the Unity Editor to display GUI controls for the property.
EndPropertyCloses a property wrapper that begins with MaterialEditor.BeginProperty.
FixupEmissiveFlagReturns a properly set global illlumination flag based on the passed in flag and the given color.
GetDefaultPropertyHeightCalculate height needed for the property, ignoring custom drawers.
GetFlexibleRectBetweenFieldAndRightEdgeUtility method for GUI layouting ShaderGUI. Used e.g for the rect after a left aligned Color field.
GetFlexibleRectBetweenLabelAndFieldUtility method for GUI layouting ShaderGUI.
GetLeftAlignedFieldRectUtility method for GUI layouting ShaderGUI.
GetMaterialPropertiesGet shader property information of the materials you pass in.
GetMaterialPropertyGet information about a single shader property.
GetMaterialPropertyNamesGets the shader property names of the materials you pass in.
GetRectAfterLabelWidthUtility method for GUI layouting ShaderGUI. This is the rect after the label which can be used for multiple properties. The input rect can be fetched by calling: EditorGUILayout.GetControlRect.
GetRightAlignedFieldRectUtility method for GUI layouting ShaderGUI.

상속된 멤버

변수

hasUnsavedChangesThis property specifies whether the Editor prompts the user to save or discard unsaved changes before the Inspector gets rebuilt.
saveChangesMessageThe message that displays to the user if they are prompted to save.
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.

Public 함수

CreateInspectorGUIImplement this method to make a custom UIElements inspector.
DiscardChangesDiscards unsaved changes to the contents of the editor.
DrawDefaultInspectorDraws 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.
OnInteractivePreviewGUIImplement to create your own interactive custom preview. Interactive custom previews are used in the preview area of the inspector 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.
RepaintRedraw any inspectors that shows this editor.
SaveChangesPerforms a save action on the contents of the editor.
UseDefaultMarginsOverride this method in subclasses to return false if you don't want default margins.
GetInstanceIDGets the instance ID of the object.
ToStringReturns the name of the object.

보호되는 함수

ShouldHideOpenButtonReturns the visibility setting of the "open" button in the Inspector.

정적 함수

CreateCachedEditorOn return previousEditor is an editor for targetObject or targetObjects. The function either returns if the editor is already tracking the objects, or destroys the previous editor and creates a new one.
CreateCachedEditorWithContextCreates a cached editor using a context object.
CreateEditorMake a custom editor for targetObject or targetObjects.
CreateEditorWithContextMake a custom editor for targetObject or targetObjects with a context object.
DrawFoldoutInspectorDraws the inspector GUI with a foldout header for target.
DestroyRemoves a GameObject, component or asset.
DestroyImmediateDestroys the object obj immediately. You are strongly recommended to use Destroy instead.
DontDestroyOnLoadDo not destroy the target Object when loading a new Scene.
FindAnyObjectByTypeRetrieves any active loaded object of Type type.
FindFirstObjectByTypeRetrieves the first active loaded object of Type type.
FindObjectOfTypeReturns the first active loaded object of Type type.
FindObjectsByTypeRetrieves a list of all loaded objects of Type type.
FindObjectsOfTypeGets a list of all loaded objects of Type type.
InstantiateClones the object original and returns the clone.
CreateInstanceCreates an instance of a scriptable object.

연산자

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

메시지

HasFrameBoundsValidates whether custom bounds can be calculated for this Editor.
OnGetFrameBoundsGets custom bounds for the target of this editor.
OnSceneGUIEnables the Editor to handle an event in the Scene view.
OnDestroyThis function is called when the scriptable object will be destroyed.
OnValidateEditor-only function that Unity calls when the script is loaded or a value changes in the Inspector.
ResetReset to default values.

Events

finishedDefaultHeaderGUIAn event raised while drawing the header of the Inspector window, after the default header items have been drawn.
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961