public override void OnInspectorGUI() { //DrawDefaultInspector(); serializedObject.Update(); myScript = (ProjectionMesh)target; EditorGUILayout.Space(); EditorGUILayout.LabelField("Reference Camera", EditorStyles.boldLabel); float planeDistance = EditorGUILayout.FloatField("Plane Distance", myScript.planeDistance); planeDistance = Mathf.Clamp(planeDistance, myScript.targetCamera.nearClipPlane + 0.01f, myScript.targetCamera.farClipPlane - 0.01f); myScript.planeDistance = planeDistance; float indexAppearDuration = EditorGUILayout.FloatField("Index Appear Duration", myScript.indexAppearDuration); indexAppearDuration = Mathf.Clamp(indexAppearDuration, 0, float.MaxValue); myScript.indexAppearDuration = indexAppearDuration; EditorGUILayout.Space(); EditorGUILayout.LabelField("Edit Mode", EditorStyles.boldLabel); myScript.editMode = (ProjectionMesh.MeshEditMode)EditorGUILayout.EnumPopup("Mesh Edit Mode", myScript.editMode); int selectedVertex = EditorGUILayout.IntField("Selected Vertex", myScript.selectedVertex); selectedVertex = Mathf.Clamp(selectedVertex, -1, (myScript.xDivisions + 1) * (myScript.yDivisions + 1) - 1); myScript.selectedVertex = selectedVertex; myScript.selectionActive = EditorGUILayout.Toggle("Selection Active", myScript.selectionActive); EditorGUILayout.BeginVertical(EditorStyles.helpBox); switch (myScript.editMode) { case ProjectionMesh.MeshEditMode.CORNERS: EditorGUILayout.LabelField("Corner Offsets", EditorStyles.boldLabel); for (int i = 0; i < 4; i++) { myScript.cornerOffset[i] = EditorGUILayout.Vector2Field("Corner Vertex " + i, myScript.cornerOffset[i]); } break; case ProjectionMesh.MeshEditMode.ROWS: /* * EditorGUILayout.LabelField("Row Offsets", EditorStyles.boldLabel); * for (int i = 0; i < myScript.yDivisions+1; i++) * { * myScript.rowOffset[i] = EditorGUILayout.Vector2Field("Row " + i, myScript.rowOffset[i]); * } */ EditorGUILayout.LabelField("Point Offsets", EditorStyles.boldLabel); for (int i = 0; i < myScript.yDivisions + 1; i++) { for (int j = 0; j < myScript.xDivisions + 1; j++) { int index = (i * (myScript.xDivisions + 1)) + j; myScript.pointOffset[index] = EditorGUILayout.Vector2Field("Point (" + i + "," + j + ")", myScript.pointOffset[index]); } } break; case ProjectionMesh.MeshEditMode.COLUMNS: /* * EditorGUILayout.LabelField("Column Offsets", EditorStyles.boldLabel); * for (int i = 0; i < myScript.xDivisions + 1; i++) * { * myScript.columnOffset[i] = EditorGUILayout.Vector2Field("Column " + i, myScript.columnOffset[i]); * } */ EditorGUILayout.LabelField("Point Offsets", EditorStyles.boldLabel); for (int i = 0; i < myScript.yDivisions + 1; i++) { for (int j = 0; j < myScript.xDivisions + 1; j++) { int index = (i * (myScript.xDivisions + 1)) + j; myScript.pointOffset[index] = EditorGUILayout.Vector2Field("Point (" + i + "," + j + ")", myScript.pointOffset[index]); } } break; case ProjectionMesh.MeshEditMode.POINTS: EditorGUILayout.LabelField("Point Offsets", EditorStyles.boldLabel); for (int i = 0; i < myScript.yDivisions + 1; i++) { for (int j = 0; j < myScript.xDivisions + 1; j++) { int index = (i * (myScript.xDivisions + 1)) + j; myScript.pointOffset[index] = EditorGUILayout.Vector2Field("Point (" + i + "," + j + ")", myScript.pointOffset[index]); } } break; default: break; } EditorGUILayout.Space(); if (GUILayout.Button("Reset All Offsets")) { myScript.ResetOffsets(); } EditorGUILayout.Space(); EditorGUILayout.EndVertical(); EditorGUILayout.Space(); EditorGUILayout.LabelField("Fade Controls", EditorStyles.boldLabel); float topFadeRange = EditorGUILayout.FloatField("Top Fade Range", myScript.topFadeRange); topFadeRange = Mathf.Clamp(topFadeRange, 0f, 1f); myScript.topFadeRange = topFadeRange; float topFadeChoke = EditorGUILayout.FloatField("Top Fade Choke", myScript.topFadeChoke); topFadeChoke = Mathf.Clamp(topFadeChoke, 0f, 0.999f); myScript.topFadeChoke = topFadeChoke; float bottomFadeRange = EditorGUILayout.FloatField("Bottom Fade Range", myScript.bottomFadeRange);; bottomFadeRange = Mathf.Clamp(bottomFadeRange, 0f, 1f); myScript.bottomFadeRange = bottomFadeRange; float bottomFadeChoke = EditorGUILayout.FloatField("Bottom Fade Choke", myScript.bottomFadeChoke); bottomFadeChoke = Mathf.Clamp(bottomFadeChoke, 0f, 0.999f); myScript.bottomFadeChoke = bottomFadeChoke; float leftFadeRange = EditorGUILayout.FloatField("Left Fade Range", myScript.leftFadeRange); leftFadeRange = Mathf.Clamp(leftFadeRange, 0f, 1f); myScript.leftFadeRange = leftFadeRange; float leftFadeChoke = EditorGUILayout.FloatField("Left Fade Choke", myScript.leftFadeChoke); leftFadeChoke = Mathf.Clamp(leftFadeChoke, 0f, 0.999f); myScript.leftFadeChoke = leftFadeChoke; float rightFadeRange = EditorGUILayout.FloatField("Right Fade Range", myScript.rightFadeRange); rightFadeRange = Mathf.Clamp(rightFadeRange, 0f, 1f); myScript.rightFadeRange = rightFadeRange; float rightFadeChoke = EditorGUILayout.FloatField("Right Fade Choke", myScript.rightFadeChoke); rightFadeChoke = Mathf.Clamp(rightFadeChoke, 0f, 0.999f); myScript.rightFadeChoke = rightFadeChoke; EditorGUILayout.Space(); EditorGUILayout.LabelField("White Balance", EditorStyles.boldLabel); myScript.tint = EditorGUILayout.ColorField("Tint", myScript.tint); EditorGUILayout.Space(); EditorGUILayout.LabelField("Grid", EditorStyles.boldLabel); myScript.unselectedGridLineMaterial = (Material)EditorGUILayout.ObjectField("Unselected Grid Line Material", myScript.unselectedGridLineMaterial, typeof(Material), true); myScript.selectedGridLineMaterial = (Material)EditorGUILayout.ObjectField("Selected Grid Line Material", myScript.selectedGridLineMaterial, typeof(Material), true); myScript.activeGridLineMaterial = (Material)EditorGUILayout.ObjectField("Active Grid Line Material", myScript.activeGridLineMaterial, typeof(Material), true); /* * myScript.unselectedLineColor = EditorGUILayout.ColorField("Unselected Line Color", myScript.unselectedLineColor); * myScript.selectedLineColor = EditorGUILayout.ColorField("Selected Line Color", myScript.selectedLineColor); * myScript.activeLineColor = EditorGUILayout.ColorField("Active Line Color", myScript.activeLineColor); */ EditorGUILayout.Space(); EditorGUILayout.LabelField("Custom Options", EditorStyles.boldLabel); myScript.showGrid = EditorGUILayout.Toggle("Show Grid", myScript.showGrid); myScript.showSelectedGrid = EditorGUILayout.Toggle("Show Selected Grid", myScript.showSelectedGrid); myScript.showControlPoints = EditorGUILayout.Toggle("Show Control Points", myScript.showControlPoints); myScript.showSelectedControlPoints = EditorGUILayout.Toggle("Show Selected Control Points", myScript.showSelectedControlPoints); if (myScript.showControlPoints) { myScript.ShowControlPoints(); } else { myScript.HideControlPoints(); } EditorGUILayout.Space(); GUIStyle foldoutStyle = new GUIStyle(EditorStyles.foldout); foldoutStyle.fontStyle = FontStyle.Bold; showReferenceGameObjects = EditorGUILayout.Foldout(showReferenceGameObjects, "Reference Game Objects", foldoutStyle); if (showReferenceGameObjects) { myScript.targetCamera = (Camera)EditorGUILayout.ObjectField("Target Camera", myScript.targetCamera, typeof(Camera), true); myScript.projectorIndexText = (Text)EditorGUILayout.ObjectField("Projector Index Text", myScript.projectorIndexText, typeof(Text), true); myScript.controlPointsContainer = (Transform)EditorGUILayout.ObjectField("Control Points Container", myScript.controlPointsContainer, typeof(Transform), true); myScript.baseRowLinesContainer = (Transform)EditorGUILayout.ObjectField("Base Row Lines", myScript.baseRowLinesContainer, typeof(Transform), true); myScript.baseColumnLinesContainer = (Transform)EditorGUILayout.ObjectField("Base Column Lines", myScript.baseColumnLinesContainer, typeof(Transform), true); myScript.selectedRowLinesContainer = (Transform)EditorGUILayout.ObjectField("Selected Row Lines", myScript.selectedRowLinesContainer, typeof(Transform), true); myScript.selectedColumnLinesContainer = (Transform)EditorGUILayout.ObjectField("Selected Column Lines", myScript.selectedColumnLinesContainer, typeof(Transform), true); myScript.meshFilter = (MeshFilter)EditorGUILayout.ObjectField("Mesh Filter", myScript.meshFilter, typeof(MeshFilter), true); myScript.selectedControlPoint = (ControlPoint)EditorGUILayout.ObjectField("Selected Control Point", myScript.selectedControlPoint, typeof(ControlPoint), true); } if (GUI.changed) { myScript.ClearControlPoints(); myScript.ClearBaseGridLines(); myScript.CreateMesh(); myScript.BlendRefresh(); if (myScript.showControlPoints) { myScript.ShowControlPoints(); } else { myScript.HideControlPoints(); } if (myScript.showSelectedControlPoints) { myScript.ShowSelectedControlPoints(); } else { myScript.HideSelectedControlPoints(); } if (myScript.showGrid) { myScript.ShowBaseGrid(); } else { myScript.HideBaseGrid(); } if (myScript.showSelectedGrid) { myScript.ShowSelectedGrid(); } else { myScript.HideSelectedGrid(); } //show selections myScript.HighlightSelection(); myScript.UpdateSelectedLines(); //EditorUtility.SetDirty(myScript); EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene()); } serializedObject.ApplyModifiedProperties(); }
void Update() { //don't allow keyboard inputs when input field is focused CalibrationManager calibrationManager = system.calibrationManager; if (calibrationManager.topRangeInputField.isFocused || calibrationManager.topChokeInputField.isFocused || calibrationManager.bottomRangeInputField.isFocused || calibrationManager.bottomChokeInputField.isFocused || calibrationManager.leftRangeInputField.isFocused || calibrationManager.leftChokeInputField.isFocused || calibrationManager.rightRangeInputField.isFocused || calibrationManager.rightChokeInputField.isFocused || calibrationManager.redInputField.isFocused || calibrationManager.greenInputField.isFocused || calibrationManager.blueInputField.isFocused || calibrationManager.filename.isFocused) { return; } ProjectionMesh mesh = system.GetCurrentProjectionCamera(); #region Visibility Toggles if (Input.GetKeyDown(uiToggleKey)) { system.showProjectionWarpGUI = !system.showProjectionWarpGUI; system.UpdateProjectionWarpGUI(); } if (Input.GetKeyDown(mouseToggleKey)) { system.showMouseCursor = !system.showMouseCursor; system.UpdateCursor(); } if (Input.GetKeyDown(gridToggleKey)) { if (mesh != null) { mesh.ToggleBaseGrid(); } } if (Input.GetKeyDown(selectedGridToggleKey)) { if (mesh != null) { mesh.ToggleSelectedGrid(); } } if (Input.GetKeyDown(controlPointsToggleKey)) { if (mesh != null) { mesh.ToggleControlPoints(); } } if (Input.GetKeyDown(selectedControlPointsToggleKey)) { if (mesh != null) { mesh.ToggleSelectedControlPoints(); } } #endregion #region UI Toggles if (Input.GetKeyDown(helpKey)) { system.calibrationManager.OnToggleHelp(); } if (Input.GetKeyDown(noModeKey)) { system.SetEditMode(ProjectionMesh.MeshEditMode.NONE); } else if (Input.GetKeyDown(cornerModeKey)) { system.SetEditMode(ProjectionMesh.MeshEditMode.CORNERS); } else if (Input.GetKeyDown(rowModeKey)) { system.SetEditMode(ProjectionMesh.MeshEditMode.ROWS); } else if (Input.GetKeyDown(columnModeKey)) { system.SetEditMode(ProjectionMesh.MeshEditMode.COLUMNS); } else if (Input.GetKeyDown(pointModeKey)) { system.SetEditMode(ProjectionMesh.MeshEditMode.POINTS); } if (Input.GetKeyDown(blendingModeKey)) { system.calibrationManager.OnToggleBlend(); } else if (Input.GetKeyDown(whiteBalanceModeKey)) { system.calibrationManager.OnToggleWhiteBalance(); } #endregion #region Projector Selection if (Input.GetKeyDown(projectorAKey) || Input.GetKeyDown(projectorAAltKey)) { system.SelectProjector(0, true); } else if (Input.GetKeyDown(projectorBKey) || Input.GetKeyDown(projectorBAltKey)) { system.SelectProjector(1, true); } else if (Input.GetKeyDown(projectorCKey) || Input.GetKeyDown(projectorCAltKey)) { system.SelectProjector(2, true); } else if (Input.GetKeyDown(projectorDKey) || Input.GetKeyDown(projectorDAltKey)) { system.SelectProjector(3, true); } else if (Input.GetKeyDown(projectorEKey) || Input.GetKeyDown(projectorEAltKey)) { system.SelectProjector(4, true); } else if (Input.GetKeyDown(projectorFKey) || Input.GetKeyDown(projectorFAltKey)) { system.SelectProjector(5, true); } else if (Input.GetKeyDown(projectorGKey) || Input.GetKeyDown(projectorGAltKey)) { system.SelectProjector(6, true); } else if (Input.GetKeyDown(projectorHKey) || Input.GetKeyDown(projectorHAltKey)) { system.SelectProjector(7, true); } #endregion #region Selection Activation if (mesh != null) { if (mesh.editMode != ProjectionMesh.MeshEditMode.NONE) { if (Input.GetKeyDown(activateKey)) { if (mesh.selectionActive) { mesh.DeactivateSelection(); } else { mesh.ActivateSelection(); } } } } #endregion #region Point Selection and Adjustment //corner indexes are at - 0, xDivisions, (xDivisions+1) * yDivisions, (xDivisions+1) * (yDivisions+1)-1 float adjustmentScale = 0.1f; if ((Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)) && (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))) { adjustmentScale = 0.001f; } if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)) { adjustmentScale = 0.01f; } else if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) { adjustmentScale = 0.1f; } if (mesh != null) { switch (mesh.editMode) { case ProjectionMesh.MeshEditMode.CORNERS: if (mesh.selectedVertex < 0) { mesh.selectedVertex = 0; } //navigate control point corners if (!mesh.selectionActive) { if (Input.GetKeyDown(upKey)) { if (mesh.selectedVertex > system.xDivisions) { mesh.selectedVertex -= ((system.xDivisions + 1) * system.yDivisions); } } if (Input.GetKeyDown(downKey)) { if (mesh.selectedVertex < system.xDivisions + 1) { mesh.selectedVertex += ((system.xDivisions + 1) * system.yDivisions); } } if (Input.GetKeyDown(leftKey)) { if (mesh.selectedVertex == system.xDivisions || mesh.selectedVertex == ((system.xDivisions + 1) * (system.yDivisions + 1) - 1)) { mesh.selectedVertex -= system.xDivisions; } } if (Input.GetKeyDown(rightKey)) { if (mesh.selectedVertex == 0 || mesh.selectedVertex == ((system.xDivisions + 1) * system.yDivisions)) { mesh.selectedVertex += system.xDivisions; } } } //move control points else { int cornerIndex = -1; if (mesh.selectedVertex == 0) { cornerIndex = 0; } else if (mesh.selectedVertex == mesh.xDivisions) { cornerIndex = 1; } else if (mesh.selectedVertex == ((mesh.xDivisions + 1) * mesh.yDivisions)) { cornerIndex = 2; } else if (mesh.selectedVertex == ((mesh.xDivisions + 1) * (mesh.yDivisions + 1) - 1)) { cornerIndex = 3; } Vector2 point = mesh.cornerOffset[cornerIndex]; if (Input.GetKeyDown(upKey)) { mesh.cornerOffset[cornerIndex] = new Vector2(point.x, point.y + (0.1f * adjustmentScale)); } if (Input.GetKeyDown(downKey)) { mesh.cornerOffset[cornerIndex] = new Vector2(point.x, point.y - (0.1f * adjustmentScale)); } if (Input.GetKeyDown(leftKey)) { mesh.cornerOffset[cornerIndex] = new Vector2(point.x - (0.1f * adjustmentScale), point.y); } if (Input.GetKeyDown(rightKey)) { mesh.cornerOffset[cornerIndex] = new Vector2(point.x + (0.1f * adjustmentScale), point.y); } if (Input.GetKey(zeroOffsetKey)) { mesh.cornerOffset[cornerIndex] = Vector2.zero; } } break; case ProjectionMesh.MeshEditMode.ROWS: if (mesh.selectedVertex < 0) { mesh.selectedVertex = 0; } //up and down selects row if (!mesh.selectionActive) { if (Input.GetKeyDown(upKey)) { if (mesh.selectedVertex > system.xDivisions) { mesh.selectedVertex -= (system.xDivisions + 1); } } if (Input.GetKeyDown(downKey)) { if (mesh.selectedVertex < ((system.xDivisions + 1) * system.yDivisions)) { mesh.selectedVertex += (system.xDivisions + 1); } } } //move row around else { //figured out which row is being moved int rowIndex = -1; rowIndex = (int)Mathf.Floor(mesh.selectedVertex / (mesh.xDivisions + 1)); Vector2 point; int index; //Vector2 point = mesh.rowOffset[rowIndex]; if (Input.GetKeyDown(upKey)) { for (var i = 0; i < mesh.xDivisions + 1; i++) { index = (rowIndex * (mesh.xDivisions + 1)) + i; point = mesh.pointOffset[index]; mesh.pointOffset[index] = new Vector2(point.x, point.y + (0.1f * adjustmentScale)); } //mesh.rowOffset[rowIndex] = new Vector2(point.x, point.y + (0.1f * adjustmentScale)); } if (Input.GetKeyDown(downKey)) { for (var i = 0; i < mesh.xDivisions + 1; i++) { index = (rowIndex * (mesh.xDivisions + 1)) + i; point = mesh.pointOffset[index]; mesh.pointOffset[index] = new Vector2(point.x, point.y - (0.1f * adjustmentScale)); } //mesh.rowOffset[rowIndex] = new Vector2(point.x, point.y - (0.1f * adjustmentScale)); } if (Input.GetKeyDown(leftKey)) { for (var i = 0; i < mesh.xDivisions + 1; i++) { index = (rowIndex * (mesh.xDivisions + 1)) + i; point = mesh.pointOffset[index]; mesh.pointOffset[index] = new Vector2(point.x - (0.1f * adjustmentScale), point.y); } //mesh.rowOffset[rowIndex] = new Vector2(point.x - (0.1f * adjustmentScale), point.y); } if (Input.GetKeyDown(rightKey)) { for (var i = 0; i < mesh.xDivisions + 1; i++) { index = (rowIndex * (mesh.xDivisions + 1)) + i; point = mesh.pointOffset[index]; mesh.pointOffset[index] = new Vector2(point.x + (0.1f * adjustmentScale), point.y); } //mesh.rowOffset[rowIndex] = new Vector2(point.x + (0.1f * adjustmentScale), point.y); } if (Input.GetKey(zeroOffsetKey)) { for (var i = 0; i < mesh.xDivisions + 1; i++) { index = (rowIndex * (mesh.xDivisions + 1)) + i; mesh.pointOffset[index] = Vector2.zero; } } } break; case ProjectionMesh.MeshEditMode.COLUMNS: if (mesh.selectedVertex < 0) { mesh.selectedVertex = 0; } //left and right selects column if (!mesh.selectionActive) { if (Input.GetKeyDown(leftKey)) { if (mesh.selectedVertex % (system.xDivisions + 1) != 0) { mesh.selectedVertex -= 1; } } if (Input.GetKeyDown(rightKey)) { if (mesh.selectedVertex % (system.xDivisions + 1) != system.xDivisions) { mesh.selectedVertex += 1; } } } //move column around else { //figured out which column is being moved int columnIndex = -1; columnIndex = mesh.selectedVertex % (mesh.xDivisions + 1); Vector2 point; int index; if (Input.GetKeyDown(upKey)) { for (var i = 0; i < mesh.yDivisions + 1; i++) { index = (i * (mesh.xDivisions + 1)) + columnIndex; point = mesh.pointOffset[index]; mesh.pointOffset[index] = new Vector2(point.x, point.y + (0.1f * adjustmentScale)); } //mesh.columnOffset[columnIndex] = new Vector2(point.x, point.y + (0.1f * adjustmentScale)); } if (Input.GetKeyDown(downKey)) { for (var i = 0; i < mesh.yDivisions + 1; i++) { index = (i * (mesh.xDivisions + 1)) + columnIndex; point = mesh.pointOffset[index]; mesh.pointOffset[index] = new Vector2(point.x, point.y - (0.1f * adjustmentScale)); } //mesh.columnOffset[columnIndex] = new Vector2(point.x, point.y - (0.1f * adjustmentScale)); } if (Input.GetKeyDown(leftKey)) { for (var i = 0; i < mesh.yDivisions + 1; i++) { index = (i * (mesh.xDivisions + 1)) + columnIndex; point = mesh.pointOffset[index]; mesh.pointOffset[index] = new Vector2(point.x - (0.1f * adjustmentScale), point.y); } //mesh.columnOffset[columnIndex] = new Vector2(point.x - (0.1f * adjustmentScale), point.y); } if (Input.GetKeyDown(rightKey)) { for (var i = 0; i < mesh.yDivisions + 1; i++) { index = (i * (mesh.xDivisions + 1)) + columnIndex; point = mesh.pointOffset[index]; mesh.pointOffset[index] = new Vector2(point.x + (0.1f * adjustmentScale), point.y); } //mesh.columnOffset[columnIndex] = new Vector2(point.x + (0.1f * adjustmentScale), point.y); } if (Input.GetKey(zeroOffsetKey)) { for (var i = 0; i < mesh.yDivisions + 1; i++) { index = (i * (mesh.xDivisions + 1)) + columnIndex; mesh.pointOffset[index] = Vector2.zero; } } } break; case ProjectionMesh.MeshEditMode.POINTS: if (mesh.selectedVertex < 0) { mesh.selectedVertex = 0; } if (!mesh.selectionActive) { if (Input.GetKeyDown(upKey)) { if (mesh.selectedVertex > system.xDivisions) { mesh.selectedVertex -= (system.xDivisions + 1); } } if (Input.GetKeyDown(downKey)) { if (mesh.selectedVertex < ((system.xDivisions + 1) * system.yDivisions)) { mesh.selectedVertex += (system.xDivisions + 1); } } if (Input.GetKeyDown(leftKey)) { if (mesh.selectedVertex % (system.xDivisions + 1) != 0) { mesh.selectedVertex -= 1; } } if (Input.GetKeyDown(rightKey)) { if (mesh.selectedVertex % (system.xDivisions + 1) != system.xDivisions) { mesh.selectedVertex += 1; } } } else { //figured out which row is being moved Vector2 point = mesh.pointOffset[mesh.selectedVertex]; if (Input.GetKeyDown(upKey)) { mesh.pointOffset[mesh.selectedVertex] = new Vector2(point.x, point.y + (0.1f * adjustmentScale)); } if (Input.GetKeyDown(downKey)) { mesh.pointOffset[mesh.selectedVertex] = new Vector2(point.x, point.y - (0.1f * adjustmentScale)); } if (Input.GetKeyDown(leftKey)) { mesh.pointOffset[mesh.selectedVertex] = new Vector2(point.x - (0.1f * adjustmentScale), point.y); } if (Input.GetKeyDown(rightKey)) { mesh.pointOffset[mesh.selectedVertex] = new Vector2(point.x + (0.1f * adjustmentScale), point.y); } if (Input.GetKey(zeroOffsetKey)) { mesh.pointOffset[mesh.selectedVertex] = Vector2.zero; } } break; default: case ProjectionMesh.MeshEditMode.NONE: break; } } #endregion if (Input.anyKeyDown) { //only rebuild when keys have been pressed if (mesh != null) { mesh.UpdateMeshVertices(); mesh.CreateBaseGridLines(); mesh.HighlightSelection(); mesh.UpdateSelectedLines(); } } }