CanvasGroup

Struct CanvasGroup 

Source
pub struct CanvasGroup {
    pub m_Alpha: f32,
    pub m_BlocksRaycasts: bool,
    pub m_GameObject: PPtr,
    pub m_IgnoreParentGroups: bool,
    pub m_Interactable: bool,
    pub m_Enabled: Option<u8>,
}
Expand description

CanvasGroup is a class of the Unity engine since version 4.6.0. Exert from Unity’s scripting documentation: A Canvas placable element that can be used to modify children Alpha, Raycasting, Enabled state. A canvas group can be used to modify the state of children elements.An example of this would be a window which fades in over time, by modifying the alpha value of the group the children elements will be affected. The result alpha will be the multiplied result of any nested groups, multiplied with the canvas elements alpha.You can configure Canvas Groups to not block raycasts. When you configure a Canvas Group to not block raycasts, graphic raycasting ignores anything in the group.Let’s say you have a Canvas GameObject with a CanvasGroup component on it, and you set the CanvasGroup component’s alpha to 0. In that case, the Canvas does not render any of its child GameObjects.

Now suppose that the Canvas also has a child CanvasGroup GameObject that you do want to render. If you enable IgnoreParentGroups for the CanvasGroup GameObject, the parent Canvas does not render any of its child GameObjects, including the CanvasGroup you want to render.

To get the child CanvasGroup GameObject, do one of two things:

In the parent Canvas, set the CanvasGroup component’s alpha to a small, non-zero value.

Add a Canvas component to the child CanvasGroup GameObject that you want to render.

Fields§

§m_Alpha: f32

Set the alpha of the group.

§m_BlocksRaycasts: bool

Does this group block raycasting (allow collision).

§m_GameObject: PPtr

The game object this component is attached to. A component is always attached to a game object. PPtr<GameObject>: (4.6.0 - 2022.3.2f1)

§m_IgnoreParentGroups: bool

Should the group ignore parent groups?

§m_Interactable: bool

Is the group interactable (are the elements beneath the group enabled).

§m_Enabled: Option<u8>

Enabled Behaviours are Updated, disabled Behaviours are not. u8: (4.6.1 - 2022.3.2f1)

Trait Implementations§

Source§

impl Debug for CanvasGroup

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for CanvasGroup

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for CanvasGroup

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,