Created
May 17, 2021 07:27
-
-
Save dinukapj/56104a6ac2976e0f3ca2b37e0f642689 to your computer and use it in GitHub Desktop.
Unity In-editor area/location mapping tool that allows you to identify different parts of a large level
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
//NOTE: Place this script inside the Editor folder in your Scripts folder. If you don't have one, you can create a folder name Editor | |
using UnityEngine; | |
using UnityEditor; | |
[CustomEditor(typeof(SceneMapper))] | |
public class SceneGUIBezierInspector : Editor | |
{ | |
void OnSceneGUI() | |
{ | |
var script = (SceneMapper)target; | |
if (script != null && script.points != null) | |
{ | |
for (int i = 0; i < script.points.Length; i++) | |
{ | |
if (script.editorMode) | |
{ | |
script.points[i].point = Handles.PositionHandle(script.points[i].point, Quaternion.identity); | |
} | |
GUIStyle guiStyle = new GUIStyle(); | |
guiStyle.fontSize = script.points[i].labelSize; | |
guiStyle.fontStyle = FontStyle.Bold; | |
guiStyle.normal.textColor = script.points[i].labelColor; | |
Handles.Label(script.points[i].point + script.labelOffset, script.points[i].label, guiStyle); | |
Handles.Label(script.points[i].point, script.pinTexture); | |
} | |
} | |
} | |
} |
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
//Place this in in your scripts folder | |
using UnityEngine; | |
public class SceneMapper : MonoBehaviour | |
{ | |
public enum PinSize { Small, Medium, Large } | |
public bool editorMode; | |
public PinSize pinSize = PinSize.Small; | |
public SceneMapPoint[] points; | |
public Vector3 labelOffset; | |
public Texture pinTexture; | |
} |
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
//Place this in in your scripts folder | |
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
[Serializable] | |
public class SceneMapPoint | |
{ | |
public string label; | |
public Vector3 point; | |
public int labelSize = 10; | |
public Color labelColor = Color.white; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment