Search Unity

UI (Case 746242) NodeCanvas graphics corruptions

Discussion in '5.3 Beta' started by sanpats, Nov 20, 2015.

  1. sanpats

    sanpats

    Joined:
    Aug 24, 2011
    Posts:
    343
    #746242

    1. What happened
    NodeCanvas (https://www.assetstore.unity3d.com/en/#!/content/14914)
    All NodeCanvas nodes the character is all shifted when zoomed out. Not happen in 5.2, this is what is like in 5.3 OpenGLCore (http://s12.photobucket.com/user/San...t 2558-11-18 at 03.29.25_zpsuqjdpg7c.png.html). With 5.3 OpenGl2 is even worse, the node graphics just disappear. It seems some Editor IMGUI pivot value is bugged.

    2. How we can reproduce it using the example you attached
    1) Start the attached project
    2) Open /Asset/Scenes/Test Scene 1.unity
    3) On Hierarchy View, choose Gamemaster gameObject
    4) On FSM Owner component, click EDIT FSM
    5) On NC Editor tab (Open when click EDIT FSM), use mouse wheel to zoom out.
    6) Observe that the zoom is pivot around wrong position, and when zoom out the text labels will pop out of nodes as the pivot is wrong too.

    @nuverian
     
    nuverian likes this.
  2. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,030
    Thanks @sanpats
    Here is a uber simplistic reproduction of the bug about GUILayout.Window and it's contents. The following code works fine in 5.2, but does not work correctly in 5.3. I suspect the rest of the issues are somewhat relevant to the source of this problem.
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEditor;
    3. using System.Collections;
    4.  
    5. public class BugEditorWindow : EditorWindow{
    6.  
    7.     private Matrix4x4 oldMatrix;
    8.     private float zoomFactor = 1f;
    9.  
    10.     [MenuItem("Window/Bug")]
    11.     public static void Open(){
    12.         var windown = GetWindow<BugEditorWindow>();
    13.         windown.Show();
    14.     }
    15.  
    16.     void OnGUI(){
    17.  
    18.         var e = Event.current;
    19.         if (e.type == EventType.ScrollWheel){
    20.             zoomFactor += e.delta.y > 0? -0.1f : 0.1f;
    21.             zoomFactor = Mathf.Clamp(zoomFactor, 0.3f, 1.7f);
    22.         }
    23.  
    24.         oldMatrix = GUI.matrix;
    25.         GUI.matrix = Matrix4x4.Scale(new Vector3(zoomFactor, zoomFactor, 1f));
    26.  
    27.         BeginWindows();
    28.         DrawWindows();
    29.         EndWindows();    
    30.  
    31.         GUI.matrix = oldMatrix;
    32.  
    33.         Repaint();
    34.     }
    35.  
    36.     void DrawWindows(){
    37.         for (var i = 0; i < 10; i++){
    38.             var rect = new Rect(i*110, 100, 100, 30);
    39.             GUILayout.Window(i, rect, OnWindow, i.ToString());
    40.         }
    41.     }
    42.  
    43.     void OnWindow(int i){
    44.         GUILayout.Label("Problem Here");
    45.     }
    46. }
     
    sanpats likes this.
  3. pfreese

    pfreese

    Unity Technologies

    Joined:
    Feb 23, 2015
    Posts:
    85
    I just confirmed that @nuverian's bug example working correctly in our development branch, which has all the text layout fixes which will be in the next 5.3 release.
     
  4. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,030
  5. sanpats

    sanpats

    Joined:
    Aug 24, 2011
    Posts:
    343
    Hi I tested with 5.3.0f2 that was released earlier today, and the problem is still exist.
     
  6. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    25,631
    Probably went in too late to catch the f2 train.