Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question SWITCH playmode on PLAY

Discussion in 'Editor & General Support' started by fla-rar, Jul 6, 2023.

  1. fla-rar

    fla-rar

    Joined:
    May 1, 2014
    Posts:
    248
    hello ...
    Is there a way to program in UNITY 2022 a SHORCUT with the keyboard, which when pressed changes the
    playmode PLAY FOCUSED to
    playmode PLAY MAXIMIZED and vice versa?
    thank you !
    .
    Screenshot 2023-07-06 at 07.44.16.png
     
  2. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    3,899
    You can switch between regular size and fullscreen by pressing Shift+Space.
    See Edit => Shortcuts... for all configurable actions.
     
  3. fla-rar

    fla-rar

    Joined:
    May 1, 2014
    Posts:
    248
    HOOO perfect thankls a lot !!!!
     
  4. fla-rar

    fla-rar

    Joined:
    May 1, 2014
    Posts:
    248
    sorry again ... to navegate ..... is there a way to make shorcuts to manipulate this ?? with keyboard ??
    ...
    (picture)
    .
    Screenshot 2023-07-06 at 22.04.12.jpg
     
  5. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    1,834
    You can make a script which does things your way, and assign whatever functions you write to new menu items, which all integrates into the shortcuts system shown above. Beware, it can snowball and get more and more complicated if you want to support 2D and 3D and perspective and orthographic views, etc.

    Code (CSharp):
    1. // example view shortcuts script
    2. // put in a folder named Editor
    3.  
    4. using UnityEngine;
    5. using UnityEditor;
    6.  
    7. public class MyCustomViewShortcuts
    8. {
    9.  
    10.     // ...
    11.  
    12.     [MenuItem("Edit/Camera/View from Bottom #^7")] // (Shift# + Ctrl^ + 7)
    13.     static void SetBottomCamera()
    14.     {
    15.         RotateCamera(Quaternion.Euler(-90, 0, 0));
    16.     }
    17.  
    18.     static void RotateCamera(Quaternion rot)
    19.     {
    20.         if (SceneView.lastActiveSceneView.in2DMode ||
    21.             SceneView.lastActiveSceneView.isRotationLocked)
    22.             return;
    23.  
    24.         SceneView.lastActiveSceneView.LookAt(lastPOI, rot);
    25.         SceneView.lastActiveSceneView.Repaint();
    26.     }
    27.  
    28.     // ...
    29. }
     
    Lars-Steenhoff likes this.
  6. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,449
    This does not work for me during playmode, is there a way to make it work during playmode?
     
  7. fla-rar

    fla-rar

    Joined:
    May 1, 2014
    Posts:
    248
    thanks so much ....
    bless
     
  8. ufulio

    ufulio

    Joined:
    May 7, 2013
    Posts:
    65
    thanks
     
  9. Saniell

    Saniell

    Joined:
    Oct 24, 2015
    Posts:
    164
    upload_2023-7-16_19-53-1.png

    Make sure you have this set correctly on newer unity versions. Though this will also make Ctrl+S spam "Scene can't be saved" during playmode which is annoying when testing crouch :(