Created
April 21, 2020 11:51
-
-
Save openroomxyz/865611336327174f25e827f97dd6dc08 to your computer and use it in GitHub Desktop.
Unity : Can i see an example of Using Gizmo Draw as debuging tool?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class ExampleDrawGizmos : MonoBehaviour | |
| { | |
| //On draw Gizmos can display debugging information in the Unity Editor | |
| //for easy visual debugging | |
| //Gizmos will not show up in your final game. | |
| //Gizmost are a debuging tool only, NOT a tool to make a game with xD | |
| //This will draw in your sceneview, you can also see it in gameview if you would like to ( | |
| private void OnDrawGizmos() | |
| { | |
| Gizmos.color = Color.blue; | |
| //Gizmos.DrawSphere(Vector3.zero, 1f); //it will draw it at zero worldspace | |
| Gizmos.DrawSphere(transform.position +new Vector3(3f,0f,0f), 0.5f + 0.1f * Mathf.Sin(Time.timeSinceLevelLoad)); | |
| //You can represent all kind of things in a visual way, and it gives more information to you when you work on your game. | |
| Gizmos.color = Color.white; | |
| Gizmos.DrawWireSphere(transform.position + new Vector3(10, 0f, 0f), 2f); | |
| //Gizmos.DrawGUITexture(new Re); | |
| Gizmos.color = Color.red; | |
| Gizmos.DrawCube(new Vector3(10f, 10f, 10f), new Vector3(1f, 2f, 3f)); | |
| //Gizmos.DrawIcon(transform.position + new Vector3(0f, 0f, 0f), "HEllo"); | |
| Gizmos.DrawLine(transform.position, Vector3.zero); | |
| Gizmos.DrawLine(transform.position + Vector3.up, transform.position + Vector3.up + Vector3.left); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment