Search Issue Tracker

Fixed

Votes

0

Found in [Package]

2.0.0a10

Issue ID

UVSB-696

Regression

No

2.0.0a10 NullReferenceException - when trying to set singleton variables or invoke singleton events from component classes

Package: Visual Scripting Bugs

-

[Original Issue|https://support.ludiq.io/communities/5/topics/4977-200a10-nullreferenceexception-when-trying-to-set-singleton-variables-or-invoke-singleton-events] - escalated by Lazlo
 
_Hi TowerCrow,_

_Thanks for the report. I had noticed that one as well while testing._ 

_At a glance, it seems like the issue is that the singleton instantiation hasn't happened yet in the first frame. Or at least that's my hypothesis for your first screenshot; in the second I'm not so sure, I'll have to look into it some more._
----
After fixing type inference most of my Inventory project errors have disappeared but here are a few new ones when trying to run the game in Generated mode:
{code:java}
NullReferenceException: Object reference not set to an instance of an object
Ludiq.Bolt.GeneratedClass`1[TShell].BindVariable[T] (System.String guid) (at Assets/Ludiq/Bolt.Core/Runtime/Generation/GeneratedClass.cs:34)
Ludiq.Bolt.Generated.InventoryManager.Bind () (at Assets/Ludiq.Generated/Transient/Scripts/InventoryManager.cs:54)
Ludiq.Bolt.BoltClassShellTrait.InstantiateGenerated (System.Func`2[T,TResult] instantiator) (at Assets/Ludiq/Bolt.Core/Runtime/Architecture/BoltClassShellTrait.cs:395)
Ludiq.Bolt.BoltClassShellTrait.InitializeGenerated[T] () (at Assets/Ludiq/Bolt.Core/Runtime/Architecture/BoltClassShellTrait.cs:387)
Ludiq.Bolt.GeneratedComponentHolderProtocol+Protocol.AddComponent[T] (UnityEngine.Object uo) (at Assets/Ludiq/Bolt.Core/Runtime/Generation/GeneratedComponentHolderProtocol.cs:28)
Ludiq.Bolt.GeneratedComponentHolderProtocol.AddGeneratedComponent[T] (UnityEngine.Object uo) (at Assets/Ludiq/Bolt.Core/Runtime/Generation/GeneratedComponentHolderProtocol.cs:37)
Ludiq.Bolt.BoltSingletonContainer.GetInstance[T] () (at Assets/Ludiq/Bolt.Core/Runtime/Architecture/BoltSingletonContainer.cs:39)
Ludiq.Bolt.GeneratedSingletonComponent`1[T].get_Instance () (at Assets/Ludiq/Bolt.Core/Runtime/Generation/GeneratedSingletonComponent.cs:11)
Ludiq.Bolt.Generated.EquipmentPanel.Start () (at Assets/Ludiq.Generated/Transient/Scripts/EquipmentPanel.cs:250)
Ludiq.Bolt.Generated.EquipmentPanel.b__24_0 (Ludiq.Bolt.EmptyEventArgs args) (at Assets/Ludiq.Generated/Transient/Scripts/EquipmentPanel.cs:77)
Ludiq.Bolt.EventBus.Invoke[TArgs] (Ludiq.Bolt.EventHook hook, TArgs args) (at Assets/Ludiq/Bolt.Core/Runtime/Events/EventBus.cs:153)
UnityEngine.Debug:LogException(Exception, Object)
Ludiq.Bolt.EventBus:Invoke(EventHook, EmptyEventArgs) (at Assets/Ludiq/Bolt.Core/Runtime/Events/EventBus.cs:157)
Ludiq.Bolt.BoltClassShellTrait:InvokeEvent(EventHookID) (at Assets/Ludiq/Bolt.Core/Runtime/Architecture/BoltClassShellTrait.cs:870)
Ludiq.Bolt.BoltUnityClassShellTrait:Start() (at Assets/Ludiq/Bolt.Core/Runtime/Architecture/BoltUnityClassShellTrait.cs:30)
Ludiq.Bolt.BoltComponent:Start() (at Assets/Ludiq/Bolt.Core/Runtime/Architecture/BoltComponent.cs:121){code}
{code:java}
NullReferenceException: Object reference not set to an instance of an object
Ludiq.Bolt.Generated.ItemSlot.RefreshSlot () (at Assets/Ludiq.Generated/Transient/Scripts/ItemSlot.cs:140)
Ludiq.Bolt.Generated.Inventory.RefreshUI () (at Assets/Ludiq.Generated/Transient/Scripts/Inventory.cs:213)
Ludiq.Bolt.Generated.Inventory.Start () (at Assets/Ludiq.Generated/Transient/Scripts/Inventory.cs:219)
Ludiq.Bolt.Generated.Inventory.b__18_0 (Ludiq.Bolt.EmptyEventArgs args) (at Assets/Ludiq.Generated/Transient/Scripts/Inventory.cs:71)
Ludiq.Bolt.EventBus.Invoke[TArgs] (Ludiq.Bolt.EventHook hook, TArgs args) (at Assets/Ludiq/Bolt.Core/Runtime/Events/EventBus.cs:153)
UnityEngine.Debug:LogException(Exception, Object)
Ludiq.Bolt.EventBus:Invoke(EventHook, EmptyEventArgs) (at Assets/Ludiq/Bolt.Core/Runtime/Events/EventBus.cs:157)
Ludiq.Bolt.BoltClassShellTrait:InvokeEvent(EventHookID) (at Assets/Ludiq/Bolt.Core/Runtime/Architecture/BoltClassShellTrait.cs:870)
Ludiq.Bolt.BoltUnityClassShellTrait:Start() (at Assets/Ludiq/Bolt.Core/Runtime/Architecture/BoltUnityClassShellTrait.cs:30)
Ludiq.Bolt.BoltComponent:Start() (at Assets/Ludiq/Bolt.Core/Runtime/Architecture/BoltComponent.cs:121){code}
{code:java}
TargetException: Missing target object for 'Ludiq.Bolt.Generated.item'.
Ludiq.OptimizedReflection.VerifyTarget (System.Type targetType, System.Object target, System.Boolean static) (at Assets/Ludiq/Ludiq.Core/Runtime/Reflection/Optimization/OptimizedReflection.cs:87)
Ludiq.OptimizedReflection.VerifyInstanceTarget[TTArget] (System.Object target) (at Assets/Ludiq/Ludiq.Core/Runtime/Reflection/Optimization/OptimizedReflection.cs:69)
Ludiq.InstancePropertyAccessor`2[TTarget,TProperty].GetValue (System.Object target) (at Assets/Ludiq/Ludiq.Core/Runtime/Reflection/Optimization/InstancePropertyAccessor.cs:78)
Ludiq.OptimizedReflection.GetValueOptimized (System.Reflection.PropertyInfo propertyInfo, System.Object target) (at Assets/Ludiq/Ludiq.Core/Runtime/Reflection/Optimization/OptimizedReflection.cs:200)
Ludiq.MemberAccessor.get_rawValue () (at Assets/Ludiq/Ludiq.Core/Editor/Meta/MemberAccessor.cs:44)
Ludiq.Accessor.get_instantiatedValue () (at Assets/Ludiq/Ludiq.Core/Editor/Meta/Accessor.cs:247)
Ludiq.Accessor.get_rawValueType () (at Assets/Ludiq/Ludiq.Core/Editor/Meta/Accessor.cs:404)
Ludiq.Accessor.get_valueType () (at Assets/Ludiq/Ludiq.Core/Editor/Meta/Accessor.cs:418)
Ludiq.Accessor.AnalyzeCollection () (at Assets/Ludiq/Ludiq.Core/Editor/Meta/Accessor.cs:438)
Ludiq.Accessor.Dig[TSubpath,TAccessor] (TSubpath subpath, System.Func`2[T,TResult] constructor, System.Boolean createInPrefab, Ludiq.Accessor prefabInstance) (at Assets/Ludiq/Ludiq.Core/Editor/Meta/Accessor.cs:617)
Ludiq.Accessor.Member (System.String name, System.Reflection.BindingFlags bindingFlags) (at Assets/Ludiq/Ludiq.Core/Editor/Meta/Accessor.cs:1360)
Ludiq.ReflectedEditor.GetMemberAccessor (System.String memberName) (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/Special/ReflectedEditor.cs:41)
Ludiq.ReflectedEditor.b__10_0 (System.String name) (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/Special/ReflectedEditor.cs:36)
System.Linq.Enumerable+SelectListIterator`2[TSource,TResult].MoveNext () (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
Ludiq.ReflectedEditor.GetInnerHeight (System.Single width) (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/Special/ReflectedEditor.cs:89)
Ludiq.Editor.GetControlHeight (System.Single width) (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/Editor.cs:139)
Ludiq.Inspector.GetFieldHeight (System.Single width) (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/Inspector.cs:237)
Ludiq.Inspector.FieldHeight (System.Single width) (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/Inspector.cs:380)
Ludiq.ReflectedEditor.GetMemberHeight (Ludiq.Inspector memberInspector, System.Single width) (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/Special/ReflectedEditor.cs:191)
Ludiq.ReflectedEditor.GetInnerHeight (System.Single width) (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/Special/ReflectedEditor.cs:96)
Ludiq.Editor.GetControlHeight (System.Single width) (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/Editor.cs:139)
Ludiq.Inspector.ControlHeight (System.Single width) (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/Inspector.cs:339)
Ludiq.Bolt.BoltClassShellTraitEditor.GetInnerHeight (System.Single width) (at Assets/Ludiq/Bolt.Core/Editor/Architecture/BoltClassShellTraitEditor.cs:227)
Ludiq.Editor.GetControlHeight (System.Single width) (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/Editor.cs:139)
Ludiq.Inspector.ControlHeight (System.Single width) (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/Inspector.cs:339)
Ludiq.Bolt.BoltClassShellEditor.GetInnerHeight (System.Single width) (at Assets/Ludiq/Bolt.Core/Editor/Architecture/BoltClassShellEditor.cs:24)
Ludiq.Editor.GetControlHeight (System.Single width) (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/Editor.cs:130)
Ludiq.Inspector.ControlHeight (System.Single width) (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/Inspector.cs:339)
Ludiq.Inspector.GetLayoutPosition (System.Func`2[T,TResult] getHeight, System.Single scrollbarTrigger) (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/Inspector.cs:834)
Ludiq.Inspector.GetControlLayoutPosition (System.Single scrollbarTrigger) (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/Inspector.cs:853)
Ludiq.Inspector.DrawControlLayout (System.Single scrollbarTrigger) (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/Inspector.cs:858)
Ludiq.LudiqRootObjectEditor+Persistent.OnGUI () (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/Root/LudiqRootObjectEditor.cs:48)
Ludiq.PersistentRootEditorWrapper.OnInspectorGUI () (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/PersistentRootEditorWrapper.cs:33)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass55_0.b__0 () (at :0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr){code}

  1. Resolution Note:

    Fixed setting singleton variables or invoking singleton events from component classes

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.