Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AssetMapGraphGUI.cs - OnGUI 함수 line 166 assetMap.window is null... #544

Open
1 of 9 tasks
masteage opened this issue Dec 28, 2024 · 2 comments
Open
1 of 9 tasks
Assignees
Labels
AssetManagement Service : AssetManagement bug Issue type : Bug report no-issue-activity

Comments

@masteage
Copy link

masteage commented Dec 28, 2024

Service

  • WebView
  • AssetManagement
  • Communicator
  • LogViewer
  • Manager
  • UI
  • Profiler
  • Adapter
  • DLST

Version

  • GPM v2.2.6
  • Common v2.4.0
  • AssetManagement v1.2.4

Describe the bug

  • 에셋 관리 - 에셋 맵 에서 error 및 gui 표기 문제..
NullReferenceException: Object reference not set to an instance of an object
Gpm.AssetManagement.AssetMap.Ui.AssetMapGraphGUI.OnGUI (UnityEngine.Rect rt) (at Assets/GPM/AssetManagement/Editor/AssetMap/Ui/AssetMapGraphGUI.cs:166)
Gpm.AssetManagement.AssetMap.Ui.AssetMapGUI.OnGUI () (at Assets/GPM/AssetManagement/Editor/AssetMap/Ui/AssetMapGUI.cs:151)
Gpm.AssetManagement.Ui.AssetManagementWindow.OnGUI () (at Assets/GPM/AssetManagement/Editor/AssetManagementWindow.cs:158)
UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition) (at <----------->:0)
UnityEditor.DockArea.DrawView (UnityEngine.Rect dockAreaRect) (at <----------->:0)
UnityEditor.DockArea.OldOnGUI () (at <----------->:0)
UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <----------->:0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <----------->:0)
UnityEngine.UIElements.IMGUIContainer.DoIMGUIRepaint () (at <----------->:0)
UnityEngine.UIElements.UIR.RenderChainCommand.ExecuteNonDrawMesh (UnityEngine.UIElements.UIR.DrawParams drawParams, System.Single pixelsPerPoint, System.Exception& immediateException) (at <----------->:0)
Rethrow as ImmediateModeException
UnityEngine.UIElements.UIR.RenderChain.Render () (at <----------->:0)
UnityEngine.UIElements.UIRRepaintUpdater.Update () (at <----------->:0)
UnityEngine.UIElements.VisualTreeUpdater.UpdateVisualTreePhase (UnityEngine.UIElements.VisualTreeUpdatePhase phase) (at <----------->:0)
UnityEngine.UIElements.Panel.UpdateForRepaint () (at <----------->:0)
UnityEngine.UIElements.Panel.Repaint (UnityEngine.Event e) (at <----------->:0)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at <----------->:0)
UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at <----------->:0)
UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <----------->:0)
UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at <----------->:0)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at <----------->:0)

To Reproduce

  1. 에셋 관리 - 에셋 맵
  2. 특정 에셋 drag&drop
  3. error 발생 및 애셋 맵 gui 표기 이슈 (확대 할때마다 error log 추가.)

Expected behavior

  • error 가 제거 되고, 정상적으로 에셋맵 gui 가 나왔으면 좋겠습니다.
  • 기타
    • assetMap.window 가 초기화가 제대로 되지 않는 flow 가 있는거 같습니다.
    • null check 를 하던 assetMap.window 의 초기화가 보증되도록 처리 되면 좋을듯 합니다.
// AssetMapGraphGUI.cs

        public AssetMapGUI(EditorWindow window)
        {
            this.window = window;
            Init();
        }

        public void OnGUI(Rect rt)
        {
        ...
        // line 166
        // NullReferenceException
        assetMap.window.BeginWindows();
        ...
        
        }

Screenshots

gui

Environment

Unity

  • Version 2021.3.34f1

Desktop

  • Windows 11 Pro
@masteage masteage added the bug Issue type : Bug report label Dec 28, 2024
@smflt-nhn smflt-nhn self-assigned this Dec 30, 2024
@smflt-nhn smflt-nhn added the AssetManagement Service : AssetManagement label Dec 30, 2024
@smflt-nhn
Copy link
Contributor

@masteage
안녕하세요. AssetMap의 window는 생성자 생성 시 설정되는 값으로 컴파일 후 AssetManagementWindow.cs 내부의 AssetMap는 남아있어 동작하나 AssetMapGraphGUI 내 부 값은 메모리에 남아있지 않을 때 발생하지 않을까 추측됩니다.
아직 정확한 발생 원인은 알 수 없으나 OnGUI 전 assetMap.window이 없을 때 window를 설정하는 코드로 보완이 될것 같습니다.

AssetManagementWindows.cs
// line 149
case Menu.ASSET_MAP:
{
    if (assetMap == null)
    {
        assetMap = new AssetMapGUI(this);
    }

    // 추가
    if (assetMap.window == null)
    {
        assetMap.window = this;
    }
    
    using (new EditorGUILayout.HorizontalScope())
    {
        assetMap.OnGUI();
    }
}
break;

추후 원인 분석 후 다음 업데이트에 포함하겠습니다.

감사합니다.

Copy link

github-actions bot commented Jan 7, 2025

Stale issue. Please check this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AssetManagement Service : AssetManagement bug Issue type : Bug report no-issue-activity
Projects
None yet
Development

No branches or pull requests

2 participants