Create runtime handles for custom editor [C#]
So i'm currently trying to create a level editor in Unity, and so far i made a little bit of progress. But I'm having some trouble with creating the handles ingame, as see in the unity editor. No youtube video seems to teach how to code them in yourself, nor can i seem to find any topics which discusses this problem. What i'm trying to do as a whole here, is to have it so when i select an object, the position handle is created at the object's position, and i can switch handles with 1, 2, and 3. Maybe have another hotkey to switch between global and local modes. So far i only have the selection code working, as shown below:
using UnityEngine;
using System.Collections;
public class EditorObjectGeneralLogic : MonoBehaviour {
private bool EditorEnabled = false;
private bool IsSelected = false;
// Use this for initialization
void Start () {
//Searches the scene for a "IsLevelEditor" object. If one is found, than enable editor mode
if (GameObject.Find("IsLevelEditor")){
EditorEnabled = true;
}
}
// Update is called once per frame
void Update () {
//Check if the scene has a "IsEditor" object. If so, then enable editor funtions"
if (EditorEnabled == true){
//Check if the object has been clicked
if (Input.GetMouseButtonDown(0)){
//Check if the object isn't "selected". If not, then select the object.
if (IsSelected == false){
IsSelected = true;
Debug.Log("Object selected");
}
}
}
}
}
If anyone would like to help me out, i would greatly appreciate it! Huge thanks to anyone who helps!
Your answer
Follow this Question
Related Questions
2d Sprite creation at 0,0,0 with camera at 0,0,0 but renders wayyy off screen 0 Answers
tagged objects problem 0 Answers
Problem with array and coroutine...Sometimes Works!!! 1 Answer
Stamina Consuption 1 Answer
Jump Script Doesn't Affect my Player 0 Answers