Version: 5.3 (switch to 5.4b)
언어English
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

MonoBehaviour.OnDrawGizmos()

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.

닫기

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.

닫기

취소

Switch to Manual

Description

선택할 수 있고 항상 화면에 나타나는 기즈모(gizmos)를 그리고 싶은 경우에 OnDrawGizmos를 사용합니다.

씬(scene)에서 중요한 오브젝트를 빠르게 선택하는 경우에 매우 유용합니다.

OnDrawGizmos는 씬 뷰와 상대적인 마우스 위치를 사용한다는 점을 주의하십시오.

This function does not get called if the component is collapsed in the inspector. Use OnDrawGizmosSelected to draw gizmos when the game object is selected.

	function OnDrawGizmos() {
		// Draw a yellow sphere at the transform's position
		Gizmos.color = Color.yellow;
		Gizmos.DrawSphere (transform.position, 1);
	}
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { void OnDrawGizmos() { Gizmos.color = Color.yellow; Gizmos.DrawSphere(transform.position, 1); } }