Search Unity

xARM: Aspect and Resolution Master [v1.8.2]

Discussion in 'Assets and Asset Store' started by Thavron, Aug 16, 2013.

  1. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,545
    5.6.x, I'm downloading from assetstore directly. It says there is an update available
     
  2. Thavron

    Thavron

    Joined:
    Aug 29, 2012
    Posts:
    360
    xARM v1.8.1 is awaiting approval.
    It adds Unity v2017.3 support and fixes some bugs.

    @PixelEnvision, @MaskedMouse
    The "ScreenCap could not been updated" issue when switching between ScreenCaps is fixed.

    v1.8.1 is also available for 5.x (v1.8 was not).
     
    MaskedMouse and Lars-Steenhoff like this.
  3. Giannigiardinelli

    Giannigiardinelli

    Joined:
    May 8, 2014
    Posts:
    100
    When I import "xARM" I have Unity asking for API Update Required I click on "I Made a Backup, Go Ahead!".

    he corrects the lines: 22 and 24

    Code (CSharp):
    1.     #if UNITY_EDITOR
    2.  
    3.     #region Fields
    4.     private static Camera _myCamera;
    5.     #endregion
    6.  
    7.     #region Properties
    8.     private Camera myCamera{
    9.         get {
    10.             if(!_myCamera){
    11. LINE 22 :        _myCamera = camera;
    12.             }
    13. LINE 24 :           return _myCamera;
    14.         }
    15.     }
    16.     #endregion
    17.  
    18.     #region Function
    When Unity corrects both lines he writes this:
    Code (CSharp):
    1.     #if UNITY_EDITOR
    2.  
    3.     #region Fields
    4.     private static Camera _myCamera;
    5.     #endregion
    6.  
    7.     #region Properties
    8.     private Camera myCamera{
    9.         get {
    10.             if(!_myCamera){
    11.     _myCamera = GetComponent<Camera>();
    12.             }
    13.             return _myCamera;
    14.         }
    15.     }
    Then I have 6 warnings!
    I then use the user guide but get to the "xARM Preview is now ready" function.

    You can manually update xARM Preview by clicking on" 1x "or activate auto update in Edit mode by toggling" Edit "in its toolbar."

    he gives me four mistakes as written above!

    But the problem is still there can you help me please?!
     
    Last edited: Feb 1, 2018
  4. Thavron

    Thavron

    Joined:
    Aug 29, 2012
    Posts:
    360
    It seams like you're not using the latest xARM version.
    Here ist the code snippet of v1.8.1:
    Code (CSharp):
    1.     #region Properties
    2.     private Camera myCamera{
    3.         get {
    4.             if(!_myCamera){
    5.                 _myCamera = GetComponent<Camera>();
    6.             }
    7.             return _myCamera;
    8.         }
    9.     }
    10.     #endregion
    So it is already using GetComponent.

    What version of xARM (see bottom of Options window) and Unity are you using?
     
  5. Giannigiardinelli

    Giannigiardinelli

    Joined:
    May 8, 2014
    Posts:
    100
    HI,

    I am using : xARM v1.04.318 avec Unity 5.5.3

    Without changing the script it shows me these errors:


    However, while you were answering the question I tried to solve the problem! I've come to make it work but I have the "GAME" window that displays and removes itself from the "Tab" option and this in window mode from where the script writes what is a bit annoying... After if there is a solution so that the "Game" window remains in option "tab" I want to be corrected because I have searched but can't find the solution... Currently after correction of the script it's not so much a problem if the game window is displayed every time I want to see the screen resolution chosen!

    If on the other hand you have the correction of your script I want you to help me do this.

    I'll show you how to fix the script that makes it work!

    Code (CSharp):
    1.     static EditorWindow GetMainGameView(){
    2.  
    3.         System.Type T = System.Type.GetType("UnityEditor.GameView,UnityEditor");
    4.         System.Reflection.MethodInfo GetMainGameView = T.GetMethod("GetMainGameView",System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static);
    5.         System.Object Res = GetMainGameView.Invoke(null,null);
    6.         return (EditorWindow)Res;      
    7.  
    8.     }
    9.  
    10.  
    11.     private static void ResizeGameView(Vector2 newSize){
    12.  
    13.         EditorWindow GameView = GetMainGameView();
    14.  
    15.  
    16.         if(!GameView) OpenGameView();
    17.  
    18.         // only resize on resolution change
    19.         if(newSize.x != Screen.width || newSize.y != Screen.height){
    20.  
    21.             Rect newPos = new Rect(0,0,0,0);
    22.  
    23.             // save original values
    24.             Vector2 prevMinSize, prevMaxSize;
    25.  
    26.             prevMinSize = GameView.minSize;
    27.             prevMaxSize = GameView.maxSize;
    28.  
    29.  
    30.  
    31.  
    32.             // undock and resize
    33.             FloatingGameView (newSize);
    34.  
    35.             // add toolbar offset
    36.             Vector2 newSizeWithOffset = newSize + GameViewToolbarOffset;
    37.  
    38.             // ensure resize
    39.             GameView.minSize = newSizeWithOffset;
    40.             GameView.maxSize = newSizeWithOffset;
    41.  
    42.             // restore previous values (keeps GV resizable)
    43.             GameView.minSize = prevMinSize;
    44.             GameView.maxSize = prevMaxSize;
    45.  
    46.             // skip update caused by this
    47.             skipNextUpdate = true;
    48.         }
    49.     }
    I added to the line 1 to 6 Options EditorWindow and add in " private static void ResizeGameView (Vector2 newSize)" both lines: 13 and 21 for call screen !

    and it works but for that I have to remove the game window from the tab.
    But otherwise it works. After if there is a possibility that it will stay on the tab please help me to correct the script!

    Thank you I await your answer regarding the resolution of the problem...
     
    Last edited: Feb 2, 2018
  6. Thavron

    Thavron

    Joined:
    Aug 29, 2012
    Posts:
    360
    Sorry for not replying sooner.

    The xARM version you are using (v1.04) is a very old version that is only compatible with Unity v4, not Unity v5 or later.
    Please use the Unity Asset Store to download the newest xARM version.
     
  7. Giannigiardinelli

    Giannigiardinelli

    Joined:
    May 8, 2014
    Posts:
    100
    Thanks Thavron but finally by correcting the script I am getting to make it work with Unity 5 but Congratulations for this application that is really convenient to stay on the right game platform format we want to achieve! I would recommend it to everyone to buy it! Thank you
     
  8. Egil-Sandfeld

    Egil-Sandfeld

    Joined:
    Oct 8, 2012
    Posts:
    41
    Getting "Screencap could not been updated" using:

    xARM 1.8.1
    Unity 2018.1.0b9




    I've tried removing xARM and downloading + import from Asset Store, but result is the same. I have tried checking and unchecking the Retina toggle in Options. The Game View Window IS on Free Aspect.

    I've been using xARM so much in the past and love it! Hope it can be fixed :)
     
  9. Egil-Sandfeld

    Egil-Sandfeld

    Joined:
    Oct 8, 2012
    Posts:
    41
    Just an update to let you know that on Mac I can actually get the screen grab to work, but only if the Retina mode toggle if off, and only for non-12.9 inch iPad resolutions! On Windows it doesn't work as I described above.
     
    Last edited: Mar 21, 2018
  10. Thavron

    Thavron

    Joined:
    Aug 29, 2012
    Posts:
    360
    I’m glad you like xARM.
    Unfortunately Beta versions of Unity are not supported. Ever Beta has its own issues.
    But you can open Game View’s stettings and check its resolution while switching between ScreenCaps and trying different xARM options. The Game View’s Resolution must match the ScreenCap’s.
    May be there is a little offset issue. If that’s the case you can try to change the GameViewToolbarOffset in xARMManager.cs
     
  11. Egil-Sandfeld

    Egil-Sandfeld

    Joined:
    Oct 8, 2012
    Posts:
    41
    Cheers, I'll try that.
     
  12. Korolev

    Korolev

    Joined:
    Sep 20, 2012
    Posts:
    14
    And when will support 2018.1?
     
  13. darkmax

    darkmax

    Joined:
    Feb 21, 2012
    Posts:
    77
    I'm trying to use xARM on unity 2018.1.0.f2 but like @Egil-Sandfeld show, I cant take the screenshots.

    Any suggestion on how to resolve this issue the latest version of unity?
     
    username132323232 likes this.
  14. username132323232

    username132323232

    Joined:
    Dec 9, 2014
    Posts:
    433
    Same problem here:

    xarm error.PNG
     
  15. Thavron

    Thavron

    Joined:
    Aug 29, 2012
    Posts:
    360
    Sorry for the delay. I’m working on it.
    An update should be ready soon.
     
  16. Panda2002

    Panda2002

    Joined:
    Jun 20, 2013
    Posts:
    1
    I was able to get around the "Could not update all ScreenCaps. Switch 'GameView' to 'Free Aspect' and (de)activate Retina/HiDPI mode in Options." error in Unity 2018 with this workaround - hope this helps.

    In xARMManager.cs:

    public static void ReadScreenCapFromGameView(xARMScreenCap screenCap){
    int width = (int)screenCap.Resolution.x;
    int height = (int)screenCap.Resolution.y;
    Debug.Log("screenCap.Resolution.x=" + screenCap.Resolution.x +
    " Screen.width=" + Screen.width +
    " screenCap.Resolution.y =" + screenCap.Resolution.y +
    " Screen.height=" + Screen.height);
    float toolbarHeight = 6;

    // check if the GameView has the correct size
    if(screenCap.Resolution.x == Screen.width && screenCap.Resolution.y == Screen.height- toolbarHeight)
    {
    // read screen to Tex2D
    Texture2D screenTex = new Texture2D(width, height, TextureFormat.RGB24, false);
    screenTex.ReadPixels (new Rect(0, toolbarHeight, width, height), 0, 0, false);
    screenTex.Apply (false, false); // readable to enable export as file


    ....



    (if for some reason your toolbarHeight is not 6, then change to the difference between screenCap.Resolution.y and Screen.height by observing the Debug.Log)
     
    Last edited: Aug 11, 2018
    Thavron likes this.
  17. Thavron

    Thavron

    Joined:
    Aug 29, 2012
    Posts:
    360
    xARM v1.8.2 adds support for Unity 2018.1

    It has a new auto detect feature for the HiDPI mode and the Game View offset. By default it is enabled in the Options, but you can also deactivate it and specify fixed values.

    Changelog:
    + Unity 2018.1 support
    + Auto detect for HiDPI mode
    + Auto detect for Game View offset (Windows only)
     
  18. Egil-Sandfeld

    Egil-Sandfeld

    Joined:
    Oct 8, 2012
    Posts:
    41

    This helped me! Thank you.
     
  19. AndyMitchell

    AndyMitchell

    Joined:
    Nov 11, 2016
    Posts:
    1
    I also got "Could not update all ScreenCaps. Ensure 'GameView' is set to 'Free Aspect' and retry (Auto detect of HiDPI mode and toolbar offset was executed"). I updated both Unity (2018.2.8f1) and xARM.

    For me, the fix was to change the display settings of my Windows laptop. I switched back to 100% and xARM started working (right click Desktop -> choose Display Settings -> Change Scale and Layout to 100%)
     
  20. RalphC

    RalphC

    Joined:
    Nov 6, 2016
    Posts:
    1
    Hi there, in 2018.3 encounter "Could not update all ScreenCaps." problem. It seems Unity restricted size of game view and once over-large size set, unity will resize game view to fit whole screen on pc. Any suggestion?
     
  21. Korolev

    Korolev

    Joined:
    Sep 20, 2012
    Posts:
    14
    My bug fix for unity 2018.3
    Code (CSharp):
    1.     public static void ReadScreenCapFromGameView(xARMScreenCap screenCap)
    2.     {
    3.  
    4.         int width = Screen.width;//xARMManager.Config.EditorUsesHIDPI?Mathf.FloorToInt(screenCap.Resolution.x/2):(int)screenCap.Resolution.x;
    5.         int height = Screen.height;// xARMManager.Config.EditorUsesHIDPI?Mathf.FloorToInt(screenCap.Resolution.y/2):(int)screenCap.Resolution.y;
    6.      
    7.         float toolbarHeight = 6;
    8.         // check if the GameView has the correct size
    9.         Debug.Log("screenCap.Resolution.x=" + width +
    10.                   " Screen.width=" + Screen.width +
    11.                   " screenCap.Resolution.y =" + height +
    12.                   " Screen.height=" + Screen.height);
    13.         // read screen to Tex2D
    14.         Texture2D screenTex = new Texture2D(width, height, TextureFormat.RGB24, false);
    15.         screenTex.ReadPixels (new Rect(0, 0, width, height), 0, 0, false);
    16.         screenTex.Apply (false, false); // readable to enable export as file
    17.  
    18.         // update ScreenCap
    19.         screenCap.Texture = screenTex;
    20.         screenCap.LastUpdateTime = lastChangeInEditorTime;
    21.         screenCap.LastUpdateTryTime = lastChangeInEditorTime;
    22.         screenCap.UpdatedSuccessful = true;
    23.            
    24.         // repaint editor windows
    25.         if(myxARMPreviewWindow) myxARMPreviewWindow.Repaint ();
    26.         if(myxARMGalleryWindow) myxARMGalleryWindow.Repaint ();
    27.         // run custom code
    28.         if(OnPostScreenCapUpdate != null) OnPostScreenCapUpdate ();
    29.  
    30.         UpdatingScreenCap = null;
    31.     }
     
  22. Thavron

    Thavron

    Joined:
    Aug 29, 2012
    Posts:
    360
    Support for Unity 2018.3 is in the works and should be ready soon.
    And thanks for your input @Korolev.
     
  23. Ascensi

    Ascensi

    Joined:
    Sep 7, 2013
    Posts:
    568
    @Thavron I'm considering purchasing your asset but I need it to create the code needed to have 2 simultaneous displays at their own native resolution, window settings etc and not to have conflict with FOV of another cam. Unity Project settings cover default but I need a preset for HTC Vive resolution and the Looking Glass Factory's Holoplayer which runs at 2560x1600 @ 60 Hz Overall in the game I'll setup the Looking Glass as an optional device. I understand your asset might be overkill for my needs but I just can't seem to get the devices to load at the same time.. For example I'd like to see the Vive working in Display/cam#2 as well as seeing a different cam's perspective from cam#1
     
  24. chmodseven

    chmodseven

    Joined:
    Jul 20, 2012
    Posts:
    36
    Hi, I've had this asset for quite a while and it's been very useful.

    Are there any plans to update it to allow options for handling the "notch" / safe area that Apple iPhone X models and some Android models? I feel this would be extremely valuable in allowing testing of UI placement on such models, particularly if the ability to test with the notch at the top/bottom (portrait) or left/right (landscape) was available, to handle all possible orientations.

    One other request: if possible, could PageUp and PageDown keys be added to the Gallery to allow for scrolling through the list using keys rather than the mouse scroll or scrollbar - would save me some RSI pain!
     
  25. Thavron

    Thavron

    Joined:
    Aug 29, 2012
    Posts:
    360
    Sorry for not replying sooner.
    xARM resizes the Game View to the resolution of the ScreenCap and then it gets the result from it. So if you want to preview two resolutions at the same time you can use xARM Gallery for it, but only one of them will be active in the Game View at the same time. xARM will iterate over the active ScreenCaps on update.
    Also changing the FOV is only possible by custom scripts via the xARM hooks.
    So I'm not sure if that is what you need. If you have further questions please let me know.
     
  26. Thavron

    Thavron

    Joined:
    Aug 29, 2012
    Posts:
    360
    I'm glad you like xARM and thanks for your feedback.
    Adding the "notch"/safe area is already on my list of RFEs. It would be indeed a very nice feature.
    And I've added your request regarding the Gallery scroll to the list. Thanks.
     
  27. AnneDraaisma

    AnneDraaisma

    Joined:
    Jul 14, 2014
    Posts:
    13
    Hi Thavron. It seems that in 2018.3 xARM is unable to hide the game view. This is results in a lot of flickering as the view is resized in view, on top of Unity.

    I have a three monitor setup. Setting up two locations in xARM options for the game view and the hidden position work as expected. The game view switches between these locations when pressing CTRL+ALT+G.

    I am unable to move the view off screen. When moving the game view manually out of view and click get windows position, it seems to get the correct coordinates. However, when selecting "test" or "hide game view", it does not move to the specified position.

    Any ideas on how to fix this? Thanks in advance.
     
  28. Ravanok7

    Ravanok7

    Joined:
    Jul 7, 2013
    Posts:
    8
    Love the asset, Used it before. Currently Not working on 2018.3.8f1
     
  29. digiross

    digiross

    Joined:
    Jun 29, 2012
    Posts:
    200
    Is this no longer supported?
     
  30. darkmax

    darkmax

    Joined:
    Feb 21, 2012
    Posts:
    77
    I like the asset but like many other had mentioned, the asset still break with current unity.

    Any update on how to fix the problem soon?


    Edit: Nevermind I resolve the problem, now is working.
     
    Last edited: Apr 25, 2019
  31. journeyman

    journeyman

    Joined:
    Mar 19, 2013
    Posts:
    7
    Can you please tell me how you resolved it? I am on Unity3D 2018.3.2f1 and followed the user guide. The xARM Preview says "Could not update all ScreenCaps. Ensure 'GameView' is set to 'Free Aspect' and retry (Autodetect of HiDPI mode and toolbar offset was executed).
    My game view is undocked and set to free aspect. How did you fix it?
     
  32. Thavron

    Thavron

    Joined:
    Aug 29, 2012
    Posts:
    360
    Sorry for not replying sooner and the delay.
    Support for 2019.1 is in the works.
     
  33. Thavron

    Thavron

    Joined:
    Aug 29, 2012
    Posts:
    360
    Please try to deactivate ScreenCaps with uneven x or y values. Also try with only some basic ScreenCaps activated. May be one ScreenCap causes all updates to fail.

    You can also test with "Editor Mode and Game View Toolbar Offset" set to manual and try some different settings for the DPI mode and the offset (try 12 for example).
    You can compare the Game Views resolution (see "Stats" - "Screen" value) with the selected ScreenCap's resolution. If they match the offset is correct.
     
  34. lolclol

    lolclol

    Joined:
    Jan 24, 2013
    Posts:
    177
    getting this error, using unity 2017.3.1

    Assets/xARM/Components/xARMProxy.cs(60,27): error CS0117: `UnityEditor.EditorApplication' does not contain a definition for `hierarchyChanged'
     
  35. journeyman

    journeyman

    Joined:
    Mar 19, 2013
    Posts:
    7
    This worked for me, thank you! (Unity version 2019.1.10)