docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class Graphic

    Base class for all UI components that should be derived from when creating new Graphic types.

    Inheritance
    object
    Object
    Component
    Behaviour
    MonoBehaviour
    UIBehaviour
    Graphic
    MaskableGraphic
    Implements
    ICanvasElement
    Inherited Members
    UIBehaviour.Awake()
    UIBehaviour.Start()
    UIBehaviour.IsActive()
    UIBehaviour.OnCanvasGroupChanged()
    UIBehaviour.IsDestroyed()
    MonoBehaviour.IsInvoking()
    MonoBehaviour.CancelInvoke()
    MonoBehaviour.Invoke(string, float)
    MonoBehaviour.InvokeRepeating(string, float, float)
    MonoBehaviour.CancelInvoke(string)
    MonoBehaviour.IsInvoking(string)
    MonoBehaviour.StartCoroutine(string)
    MonoBehaviour.StartCoroutine(string, object)
    MonoBehaviour.StartCoroutine(IEnumerator)
    MonoBehaviour.StartCoroutine_Auto(IEnumerator)
    MonoBehaviour.StopCoroutine(IEnumerator)
    MonoBehaviour.StopCoroutine(Coroutine)
    MonoBehaviour.StopCoroutine(string)
    MonoBehaviour.StopAllCoroutines()
    MonoBehaviour.print(object)
    MonoBehaviour.useGUILayout
    MonoBehaviour.runInEditMode
    Behaviour.enabled
    Behaviour.isActiveAndEnabled
    Component.GetComponent(Type)
    Component.GetComponent<T>()
    Component.TryGetComponent(Type, out Component)
    Component.TryGetComponent<T>(out T)
    Component.GetComponent(string)
    Component.GetComponentInChildren(Type, bool)
    Component.GetComponentInChildren(Type)
    Component.GetComponentInChildren<T>(bool)
    Component.GetComponentInChildren<T>()
    Component.GetComponentsInChildren(Type, bool)
    Component.GetComponentsInChildren(Type)
    Component.GetComponentsInChildren<T>(bool)
    Component.GetComponentsInChildren<T>(bool, List<T>)
    Component.GetComponentsInChildren<T>()
    Component.GetComponentsInChildren<T>(List<T>)
    Component.GetComponentInParent(Type, bool)
    Component.GetComponentInParent(Type)
    Component.GetComponentInParent<T>(bool)
    Component.GetComponentInParent<T>()
    Component.GetComponentsInParent(Type, bool)
    Component.GetComponentsInParent(Type)
    Component.GetComponentsInParent<T>(bool)
    Component.GetComponentsInParent<T>(bool, List<T>)
    Component.GetComponentsInParent<T>()
    Component.GetComponents(Type)
    Component.GetComponents(Type, List<Component>)
    Component.GetComponents<T>(List<T>)
    Component.GetComponents<T>()
    Component.CompareTag(string)
    Component.SendMessageUpwards(string, object, SendMessageOptions)
    Component.SendMessageUpwards(string, object)
    Component.SendMessageUpwards(string)
    Component.SendMessageUpwards(string, SendMessageOptions)
    Component.SendMessage(string, object)
    Component.SendMessage(string)
    Component.SendMessage(string, object, SendMessageOptions)
    Component.SendMessage(string, SendMessageOptions)
    Component.BroadcastMessage(string, object, SendMessageOptions)
    Component.BroadcastMessage(string, object)
    Component.BroadcastMessage(string)
    Component.BroadcastMessage(string, SendMessageOptions)
    Component.transform
    Component.gameObject
    Component.tag
    Object.GetInstanceID()
    Object.GetHashCode()
    Object.Equals(object)
    Object.Instantiate(Object, Vector3, Quaternion)
    Object.Instantiate(Object, Vector3, Quaternion, Transform)
    Object.Instantiate(Object)
    Object.Instantiate(Object, Transform)
    Object.Instantiate(Object, Transform, bool)
    Object.Instantiate<T>(T)
    Object.Instantiate<T>(T, Vector3, Quaternion)
    Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
    Object.Instantiate<T>(T, Transform)
    Object.Instantiate<T>(T, Transform, bool)
    Object.Destroy(Object, float)
    Object.Destroy(Object)
    Object.DestroyImmediate(Object, bool)
    Object.DestroyImmediate(Object)
    Object.FindObjectsOfType(Type)
    Object.FindObjectsOfType(Type, bool)
    Object.FindObjectsByType(Type, FindObjectsSortMode)
    Object.FindObjectsByType(Type, FindObjectsInactive, FindObjectsSortMode)
    Object.DontDestroyOnLoad(Object)
    Object.DestroyObject(Object, float)
    Object.DestroyObject(Object)
    Object.FindSceneObjectsOfType(Type)
    Object.FindObjectsOfTypeIncludingAssets(Type)
    Object.FindObjectsOfType<T>()
    Object.FindObjectsByType<T>(FindObjectsSortMode)
    Object.FindObjectsOfType<T>(bool)
    Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)
    Object.FindObjectOfType<T>()
    Object.FindObjectOfType<T>(bool)
    Object.FindFirstObjectByType<T>()
    Object.FindAnyObjectByType<T>()
    Object.FindFirstObjectByType<T>(FindObjectsInactive)
    Object.FindAnyObjectByType<T>(FindObjectsInactive)
    Object.FindObjectsOfTypeAll(Type)
    Object.FindObjectOfType(Type)
    Object.FindFirstObjectByType(Type)
    Object.FindAnyObjectByType(Type)
    Object.FindObjectOfType(Type, bool)
    Object.FindFirstObjectByType(Type, FindObjectsInactive)
    Object.FindAnyObjectByType(Type, FindObjectsInactive)
    Object.ToString()
    Object.name
    Object.hideFlags
    object.Equals(object, object)
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: UnityEngine.UI
    Assembly: UnityEngine.UI.dll
    Syntax
    [DisallowMultipleComponent]
    [RequireComponent(typeof(RectTransform))]
    [ExecuteAlways]
    public abstract class Graphic : UIBehaviour, ICanvasElement

    Constructors

    Name Description
    Graphic()

    Fields

    Name Description
    m_CachedMesh
    m_CachedUvs
    m_Material
    m_OnDirtyLayoutCallback
    m_OnDirtyMaterialCallback
    m_OnDirtyVertsCallback
    m_SkipLayoutUpdate
    m_SkipMaterialUpdate
    s_DefaultUI
    s_Mesh
    s_WhiteTexture

    Properties

    Name Description
    canvas

    A reference to the Canvas this Graphic is rendering to.

    canvasRenderer

    A reference to the CanvasRenderer populated by this Graphic.

    color

    Base color of the Graphic.

    defaultGraphicMaterial

    Default material used to draw UI elements if no explicit material was specified.

    defaultMaterial

    Returns the default material for the graphic.

    depth

    Absolute depth of the graphic, used by rendering and events -- lowest to highest.

    mainTexture

    The graphic's texture. (Read Only).

    material

    The Material set by the user

    materialForRendering

    The material that will be sent for Rendering (Read only).

    raycastPadding

    Padding to be applied to the masking X = Left Y = Bottom Z = Right W = Top

    raycastTarget

    Should this graphic be considered a target for raycasting?

    rectTransform

    The RectTransform component used by the Graphic. Cached for speed.

    useLegacyMeshGeneration
    workerMesh

    Methods

    Name Description
    CrossFadeAlpha(float, float, bool)

    Tweens the alpha of the CanvasRenderer color associated with this Graphic.

    CrossFadeColor(Color, float, bool, bool)

    Tweens the CanvasRenderer color associated with this Graphic.

    CrossFadeColor(Color, float, bool, bool, bool)

    Tweens the CanvasRenderer color associated with this Graphic.

    GetPixelAdjustedRect()

    Returns a pixel perfect Rect closest to the Graphic RectTransform.

    GraphicUpdateComplete()

    Callback sent when this ICanvasElement has completed Graphic rebuild.

    LayoutComplete()

    Callback sent when this ICanvasElement has completed layout.

    OnBeforeTransformParentChanged()
    OnCanvasHierarchyChanged()

    Called when the state of the parent Canvas is changed.

    OnCullingChanged()

    This method must be called when CanvasRenderer.cull is modified.

    OnDestroy()
    OnDidApplyAnimationProperties()
    OnDisable()

    Clear references.

    OnEnable()

    Mark the Graphic and the canvas as having been changed.

    OnPopulateMesh(Mesh)
    OnPopulateMesh(VertexHelper)

    Callback function when a UI element needs to generate vertices. Fills the vertex buffer data.

    OnRebuildRequested()

    Editor-only callback that is issued by Unity if a rebuild of the Graphic is required. Currently sent when an asset is reimported.

    OnRectTransformDimensionsChange()

    This callback is called when the dimensions of an associated RectTransform change. It is always called before Awake, OnEnable, or Start. The call is also made to all child RectTransforms, regardless of whether their dimensions change (which depends on how they are anchored).

    OnTransformParentChanged()
    OnValidate()
    PixelAdjustPoint(Vector2)

    Adjusts the given pixel to be pixel perfect.

    Raycast(Vector2, Camera)

    When a GraphicRaycaster is raycasting into the scene it does two things. First it filters the elements using their RectTransform rect. Then it uses this Raycast function to determine the elements hit by the raycast.

    Rebuild(CanvasUpdate)

    Rebuilds the graphic geometry and its material on the PreRender cycle.

    RegisterDirtyLayoutCallback(UnityAction)

    Add a listener to receive notification when the graphics layout is dirtied.

    RegisterDirtyMaterialCallback(UnityAction)

    Add a listener to receive notification when the graphics material is dirtied.

    RegisterDirtyVerticesCallback(UnityAction)

    Add a listener to receive notification when the graphics vertices are dirtied.

    Reset()
    SetAllDirty()

    Set all properties of the Graphic dirty and needing rebuilt. Dirties Layout, Vertices, and Materials.

    SetLayoutDirty()

    Mark the layout as dirty and needing rebuilt.

    SetMaterialDirty()

    Mark the material as dirty and needing rebuilt.

    SetNativeSize()

    Make the Graphic have the native size of its content.

    SetRaycastDirty()
    SetVerticesDirty()

    Mark the vertices as dirty and needing rebuilt.

    UnregisterDirtyLayoutCallback(UnityAction)

    Remove a listener from receiving notifications when the graphics layout are dirtied

    UnregisterDirtyMaterialCallback(UnityAction)

    Remove a listener from receiving notifications when the graphics material are dirtied

    UnregisterDirtyVerticesCallback(UnityAction)

    Remove a listener from receiving notifications when the graphics vertices are dirtied

    UpdateGeometry()

    Call to update the geometry of the Graphic onto the CanvasRenderer.

    UpdateMaterial()

    Call to update the Material of the graphic onto the CanvasRenderer.

    In This Article
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023