2017-02-03 98 views
0
GetBool is not allowed to be called from a ScriptableObject constructor (or instance field initializer), call it in OnEnable instead. Called from ScriptableObject 'FGConsole'. 
See "Script Serialization" page in the Unity Manual for further details. 
UnityEditor.EditorPrefs:GetBool(String, Boolean) 
ScriptInspector.FGConsole:.cctor() (at Assets/Plugins/Editor/ScriptInspector3/Scripts/FGConsole.cs:65) 

我有一個團結的錯誤調用。 上面的錯誤顯示在控制檯中,它不允許我將腳本附加到遊戲對象並編譯我的錯誤。 如何清除此錯誤?錯誤:GetBool不允許團結作爲資產使用腳本檢查後3從是ScriptableObject構造

+0

我想我會嘗試從ScriptableObject構造函數中移除GetBool方法,呵呵。你寫過從ScriptableObject派生的任何類嗎?在那個構造函數中,你看起來不允許使用GetBool。向我們展示圍繞FGConsole.cs第65行的代碼,這是異常指向的地方。否則,我猜測Script Inpsector 3中存在一個錯誤。 – Maakep

+0

這些腳本都是默認設置,所以我不知道該怎麼辦? –

+0

static FGConsole() \t { \t \t _openLogEntriesInSi2 = EditorPrefs.GetBool(「ScriptInspector.OpenLogEntriesInSi2」,true); \t \t consoleWindowType = typeof(EditorWindow).Assembly.GetType(「UnityEditor.ConsoleWindow」); \t \t ....... –

回答

1

Niresh,您正在使用的Script Inspector 3的版本對於較新版本的Unity來說太舊了。在2016年7月,Unity發佈了5.4版本,並且Script Inspector 3升級到3.0.13版本以支持這些更改。只需將您的副本從Unity資源商店更新到最新發布的Si3版本(目前3.0.17),它就可以正常工作。

相關問題