Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class EditorControls : MonoBehaviour {
- bool ShiftHeld;
- public EditorGlobals GlobalAccess;
- void Start()
- {
- // Required to have GlobalAccess
- GlobalAccess = GameObject.Find("EditorGlobals").GetComponent<EditorGlobals>();
- }
- // Update is called once per frame
- void Update ()
- {
- ShiftHeld = Input.GetKey(KeyCode.LeftShift);
- if (!GlobalAccess.OverToolbar)
- MouseControlGrid();
- }
- // This function is only called when the mouse is on the editor and has permission to make edits.
- void MouseControlGrid()
- {
- // Mouse controls while shift is not being held.
- if (!ShiftHeld)
- {
- if (Input.GetMouseButtonDown(0))
- {
- Instantiate(GlobalAccess.Components.RequestGameObject(GlobalAccess.ComponentSelected));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement