기술 자료

​
​

Development

User Acquisition

Monetization

산업 분야

Unity Studio

Open Unity Studio

Unity Studio

이 페이지는 선택한 언어로 제공되지 않습니다.
​
​
Unity Studio
  • What's new in Unity Studio
  • Introduction to Unity Studio
  • Launch Unity Studio
  • Create your first Unity Studio project
  • Develop with Unity Studio
    • The Unity Studio interface
    • Save your progress
    • GameObjects
    • Assets
    • Materials
    • Scene settings
    • Logic
      • Introduction to Logic
      • Create a Logic script
      • The Logic Editor interface
      • Methods, variables, and parameters
      • Nodes
      • Logic examples
        • Use a button to transform a GameObject
        • Hide or show a User Interface (UI) element
        • Trigger an animation on key press
        • Adjust scene lighting with a button
        • Interact with an asset after an event
        • Display the name of a GameObject on hover
        • Enable or disable a property on a GameObject
        • Play audio when you click an object
        • Mute and unmute audio with the toggle element
        • Use sliders to change a material's color
    • The UI Creator
    • Animation
    • AI features
  • Collaborate in Unity Studio
  • Export drafts to the Unity Editor
  • Publish and share
  • Troubleshooting Unity Studio issues
  • Report bugs and share feedback
  • Manage your analytics and marketing preferences
  1. Unity Studio
  2. Develop with Unity Studio
  3. Logic
  4. Logic examples

Display the name of a GameObject on hover

Learn how to display the name of a GameObject when the user hovers over it with their cursor.
읽는 시간 2분
최근 업데이트: 2달 전

Use this example to learn how to display the name of a GameObject when the user hovers over it with their cursor.
1

Add a Text element to your UI Canvas

  1. Select UI Canvas in the Hierarchy panel.
  2. Right-click and choose UI > Text to create a new Text element.
2

Create a New Logic script

  1. In the Project panel, select the My Logic folder.
  2. Select Add (+).
  3. Select Script. Unity Studio creates a new Logic script in the folder.
  4. Enter a name for your script and press Enter.
3

Add the script to a GameObject

  1. Select or create a GameObject from the Hierarchy panel.
  2. From the Inspector panel, select Add Component.
  3. Choose your Logic script from the list.
  4. Select the field at the top of the Inspector panel to rename the object.
4

Show the name when hovered

  1. In the Project panel, double-click the Logic script to open the Logic Editor.
  2. Drag a While event listener into the Logic Editor.
  3. Add a Mouse Over event inside the While node.
  4. Drag the Me variable into the Object socket of the Mouse Over event.
  5. Add a Set Text action inside the While block.
  6. Create a new variable for the Text UI element with a type of Object.
  7. Drag the Text variable into the Set Text action’s socket.
  8. In the variable panel, expand the Text variable and drag the Name property of Me into the value socket for the Set Text node.
Example Logic script to display the GameObject name on hover.

Example Logic script to display the GameObject name on hover.

5

Hide the name when not hovered

  1. Right-click the first Logic block and select Duplicate.
  2. In the Node Library panel’s search bar, look for Not.
  3. Drag the Not node into the Logic Editor.
  4. Drag the Mouse is over Me output from your duplicated logic block into the Not node’s socket.
  5. Drag the combined Not node into the condition socket of the duplicated While event listener.
  6. In the Set Text node, remove the me > name property and leave it empty.
  7. Close the Logic Editor.
Example Logic script to hide the GameObject name when not hovered.

Example Logic script to hide the GameObject name when not hovered.

6

Connect your script references

  1. In the Hierarchy panel, select the GameObject that has your Logic script attached.
  2. Drag the Text UI element from the Hierarchy panel into the Text variable reference in your script component.
Press Play to test your scene. The UI text displays the name of the GameObject when you hover over it with your cursor.

Additional resources

  • Introduction to Logic
  • The Logic Editor interface
  • Create a Logic script
  • Methods and variables
  • Nodes
  • Logic examples

Copyright © 2026 Unity Technologies
법률 정보개인정보 처리방침쿠키Documentation Terms of Use개인 정보 판매 또는 공유 금지개인정보 보호 선택(쿠키 설정)

'Unity', Unity 로고 및 기타 Unity 상표는 미국 및 기타 지역 내 Unity Technologies 또는 그 계열사의 상표 또는 등록상표입니다(자세한 내용은 여기에서 확인하세요). 기타 명칭 또는 브랜드는 해당 소유자의 상표입니다.

일부 페이지는 편의를 위해 기계 번역되었으며 부정확한 내용이 있을 수 있습니다. 정보가 상충되는 경우, 영어 버전을 우선으로 참조하세요.

  • 보고 있는 페이지
    • Additional resources


이 페이지의 문제 보고