简体   繁体   中英

Unity psb file import null reference

So I just wanted to import my 2d character into unity and when I drag the PSB file into unity. It just gives me this error:

NullReferenceException: Max Size: SerializedProperty is null
UnityEditor.EditorGUI.BeginPropertyInternal (UnityEngine.Rect totalPosition, UnityEngine.GUIContent label, UnityEditor.SerializedProperty property) (at <0d6ce211ebbc47e1a35a84c3672ff58f>:0)
UnityEditor.EditorGUI.BeginProperty (UnityEngine.Rect totalPosition, UnityEngine.GUIContent label, UnityEditor.SerializedProperty property) (at <0d6ce211ebbc47e1a35a84c3672ff58f>:0)
UnityEditor.Modules.DefaultTextureImportSettingsExtension.ShowImportSettings (UnityEditor.BaseTextureImportPlatformSettings editor) (at <0d6ce211ebbc47e1a35a84c3672ff58f>:0)
UnityEditor.BaseTextureImportPlatformSettings.ShowPlatformSpecificSettings (System.Collections.Generic.List`1[T] platformSettings, System.Int32 selected) (at <0d6ce211ebbc47e1a35a84c3672ff58f>:0)
UnityEditor.U2D.Common.TexturePlatformSettingsHelper.ShowPlatformSpecificSettings () (at Library/PackageCache/com.unity.2d.common@6.0.3/Editor/InternalBridge/TexturePlatformSettings/TexturePlatformSettings.cs:158)
UnityEditor.U2D.PSD.PSDImporterEditor.DoPlatformSettings () (at Library/PackageCache/com.unity.2d.psdimporter@6.0.4/Editor/PSDImporterEditor.cs:419)
UnityEditor.U2D.PSD.PSDImporterEditor.DoSettingsUI () (at Library/PackageCache/com.unity.2d.psdimporter@6.0.4/Editor/PSDImporterEditor.cs:274)
UnityEditor.U2D.PSD.PSDImporterEditor.OnInspectorGUI () (at Library/PackageCache/com.unity.2d.psdimporter@6.0.4/Editor/PSDImporterEditor.cs:232)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass59_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <122642d41668428d845063b1753c4e72>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

在此处输入图像描述

I found the solution!!! you can close the platform settings of the PSD import error that is causing the problem

Create a C# script called FixPSDImporter and paste this inside and fixed!

 public static class FixPSDImporter
    {
        [UnityEditor.InitializeOnLoadMethod]
        public static void ResetPSDImporterFoldout()
        {
            UnityEditor.EditorPrefs.DeleteKey("PSDImporterEditor.m_PlatformSettingsFoldout");
        }
    }

Solution found here: https://forum.unity.com/threads/psb-asset-inspector-window-is-breaking.1334079/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM