// Toggle menu // "Cancel" is usually bind to ESC // Alternative bind : LeftShift + C // (In UnitEditor ESC activates cursor automatically. You can avoid this behavior by using alternative bind.) private void ToggleQuickMenuOperation() { if (Input.GetButtonUp("Cancel") #if UNITY_EDITOR || (Input.GetKey(KeyCode.LeftShift) && Input.GetKeyDown(KeyCode.C)) #endif ) { Iwlog.Trace("Toggle QuickMenu"); if (QuickMenu.activeSelf) { QuickMenu.SetActive(false); } else { QuickMenu.transform.position = QuckMenuInitLoc.transform.position; QuickMenu.transform.rotation = QuckMenuInitLoc.transform.rotation; QuickMenu.SetActive(true); } } }
private void CopyPostProcessingV2(Camera srcCamera, Camera dstCamera) { var ppLayerType = Type.GetType("UnityEngine.Rendering.PostProcessing.PostProcessLayer, Unity.Postprocessing.Runtime"); if (ppLayerType == null) { Iwlog.Trace("PostProcessing v2 not exists"); } else { var srcPpLayerComp = srcCamera.GetComponent(ppLayerType); if (srcPpLayerComp != null) { var dstPpLayerComp = dstCamera.GetComponent(ppLayerType); if (dstPpLayerComp != null) { Iwlog.Warn(dstCamera.gameObject, "Unexpected PostProcessLayer exists."); } else { dstPpLayerComp = dstCamera.gameObject.AddComponent(ppLayerType); } #if UNITY_EDITOR UnityEditor.EditorUtility.CopySerialized(srcPpLayerComp, dstPpLayerComp); #else Iwlog.Error("not implemented for runtime"); #endif // replace volumeTrigger if camera itself. (That is usual case) FieldInfo fldInfo = ppLayerType.GetField("volumeTrigger"); Assert.IsNotNull(fldInfo); if ((Transform)fldInfo.GetValue(srcPpLayerComp) == srcCamera.transform) { fldInfo.SetValue(dstPpLayerComp, dstCamera.transform); } } } }
// Toggle quick menu // "Cancel" is usually bind to ESC // Alternative bind : Q // (In UnitEditor ESC activates mouse cursor automatically. You can avoid this behavior by using alternative bind.) private void ToggleQuickMenuOperation() { if (Input.GetKeyDown(KeyCode.Tab)) { Iwlog.Trace("Toggle QuickMenu"); if (QuickMenu.activeSelf) { QuickMenu.SetActive(false); } else { QuickMenu.transform.position = QuckMenuInitLoc.transform.position; QuickMenu.transform.rotation = QuckMenuInitLoc.transform.rotation; QuickMenu.SetActive(true); } } if (Input.GetKeyDown(KeyCode.F12)) { // For interactive print debug // Iwlog.Debug("Hi from F12"); // Iwlog.Debug("Camera.main=" + Camera.main); } }