Version: Unity 6.7 Alpha (6000.7)
LanguageEnglish
  • C#

VisualElement.GetComponent

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public ref T GetComponent();

Returns

T A reference to the live component data.

Description

Returns a reference to the attached component of type T.

The reference points at the component's live storage: assigning to its fields updates the element directly, with no need to write the value back. The reference stays valid until the component is removed.