Version: 2023.2
언어: 한국어

Material

class in UnityEngine

/

다음으로부터 상속:Object

매뉴얼로 전환

설명

The material class.

This class exposes all properties from a material, allowing you to animate them. You can also use it to set custom shader properties that can't be accessed through the inspector (e.g. matrices).

In order to get the material used by an object, use the Renderer.material property.

Additional resources: Materials, Shaders.

변수

colorThe main color of the Material.
doubleSidedGIGets and sets whether the Double Sided Global Illumination setting is enabled for this material.
enabledKeywordsAn array containing the local shader keywords that are currently enabled for this material.
enableInstancingGets and sets whether GPU instancing is enabled for this material.
globalIlluminationFlagsDefines how the material should interact with lightmaps and lightprobes.
isVariantReturns true if this material is a material variant.
mainTextureThe main texture.
mainTextureOffsetThe offset of the main texture.
mainTextureScaleThe scale of the main texture.
parentParent of this material.
passCountHow many passes are in this material (Read Only).
renderQueueRender queue of this material.
shaderThe shader used by the material.
shaderKeywordsAn array containing names of the local shader keywords that are currently enabled for this material.

생성자

Material

Public 함수

ApplyPropertyOverrideApplies an override associated with a Material Variant to a target.
ComputeCRCComputes a CRC hash value from the content of the material.
CopyMatchingPropertiesFromMaterialCopies properties, keyword states and settings from mat to this material, but only if they exist in both materials.
CopyPropertiesFromMaterialCopy properties from other material into this material.
DisableKeywordDisables a local shader keyword for this material.
EnableKeywordEnables a local shader keyword for this material.
FindPassReturns the index of the pass passName.
GetBufferGet a named Graphics Buffer value.
GetColorGet a named color value.
GetColorArrayGet a named color array.
GetConstantBufferGet a named Constant Buffer value.
GetFloatGet a named float value.
GetFloatArrayGet a named float array.
GetIntThis method is deprecated. Use GetFloat or GetInteger instead.
GetIntegerGet a named integer value.
GetMatrixGet a named matrix value from the shader.
GetMatrixArrayGet a named matrix array.
GetPassNameReturns the name of the shader pass at index pass.
GetPropertyNamesRetrieves a list of the named properties in the material that match the input property type.
GetShaderPassEnabledChecks whether a given Shader pass is enabled on this Material.
GetTagGet the value of material's shader tag.
GetTextureGet a named texture.
GetTextureOffsetGets the placement offset of texture propertyName.
GetTexturePropertyNameIDsReturn the name IDs of all texture properties exposed on this material.
GetTexturePropertyNamesReturns the names of all texture properties exposed on this material.
GetTextureScaleGets the placement scale of texture propertyName.
GetVectorGet a named vector value.
GetVectorArrayGet a named vector array.
HasBufferChecks if the ShaderLab file assigned to the Material has a ComputeBuffer property with the given name.
HasColorChecks if the ShaderLab file assigned to the Material has a Color property with the given name.
HasConstantBufferChecks if the ShaderLab file assigned to the Material has a ConstantBuffer property with the given name.
HasFloatChecks if the ShaderLab file assigned to the Material has a Float property with the given name. This also works with the Float Array property.
HasIntThis method is deprecated. Use HasFloat or HasInteger instead.
HasIntegerChecks if the ShaderLab file assigned to the Material has an Integer property with the given name.
HasMatrixChecks if the ShaderLab file assigned to the Material has a Matrix property with the given name. This also works with the Matrix Array property.
HasPropertyChecks if the ShaderLab file assigned to the Material has a property with the given name.
HasTextureChecks if the ShaderLab file assigned to the Material has a Texture property with the given name.
HasVectorChecks if the ShaderLab file assigned to the Material has a Vector property with the given name. This also works with the Vector Array property.
IsChildOfReturns True if the given material is an ancestor of this Material.
IsKeywordEnabledChecks whether a local shader keyword is enabled for this material.
IsPropertyLockedChecks whether a property is locked by this material.
IsPropertyLockedByAncestorChecks whether a property is locked by any of ancestor of this material.
IsPropertyOverridenChecks whether a property is overriden by this material.
LerpInterpolate properties between two materials.
RevertAllPropertyOverridesRemoves all property overrides on this material.
RevertPropertyOverrideRemoves the override on a property.
SetBufferSets a named buffer value.
SetColorSets a color value.
SetColorArraySets a color array property.
SetConstantBufferSets a ComputeBuffer or GraphicsBuffer as a named constant buffer for the material.
SetFloatSets a named float value.
SetFloatArraySets a float array property.
SetIntThis method is deprecated. Use SetFloat or SetInteger instead.
SetIntegerSets a named integer value.
SetKeywordSets the state of a local shader keyword for this material.
SetMatrixSets a named matrix for the shader.
SetMatrixArraySets a matrix array property.
SetOverrideTagSets an override tag/value on the material.
SetPassActivate the given pass for rendering.
SetPropertyLockSets the lock state of a property for this material.
SetShaderPassEnabledEnables or disables a Shader pass on a per-Material level.
SetTextureSets a named texture.
SetTextureOffsetSets the placement offset of a given texture. The name parameter is defined in the shader. This method creates a new Material instance.
SetTextureScaleSets the placement scale of texture propertyName.
SetVectorSets a named vector value.
SetVectorArraySets a vector array property.

상속된 멤버

변수

hideFlagsShould the object be hidden, saved with the Scene or modifiable by the user?
nameThe name of the object.

Public 함수

GetInstanceIDGets the instance ID of the object.
ToStringReturns the name of the object.

정적 함수

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.
FindObjectsByTypeRetrieves a list of all loaded objects of Type type.
InstantiateClones the object original and returns the clone.

연산자

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.