C
C#2y ago
Elmishh

❔ need help understanding a null ref exception

System.NullReferenceException
at (wrapper managed-to-native) UnityEngine.GameObject.GetComponentFastPath(UnityEngine.GameObject,System.Type,intptr)
at UnityEngine.GameObject.GetComponent[T] () [0x00021] in <97fdf0a75ab94da9a7e5188c186e574d>:0
at HandMiniGame.Plugin.Update () [0x00119] in <6bd10a6628e64a569f2780a44c50b1b4>:0 at (wrapper managed-to-native) UnityEngine.GameObject.GetComponentFastPath(UnityEngine.GameObject,System.Type,intptr)
at UnityEngine.GameObject.GetComponent[T] () [0x00021] in <97fdf0a75ab94da9a7e5188c186e574d>:0
at HandMiniGame.Plugin.Update () [0x00119] in <6bd10a6628e64a569f2780a44c50b1b4>:0
(Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 35)
System.NullReferenceException
at (wrapper managed-to-native) UnityEngine.GameObject.GetComponentFastPath(UnityEngine.GameObject,System.Type,intptr)
at UnityEngine.GameObject.GetComponent[T] () [0x00021] in <97fdf0a75ab94da9a7e5188c186e574d>:0
at HandMiniGame.Plugin.Update () [0x00119] in <6bd10a6628e64a569f2780a44c50b1b4>:0 at (wrapper managed-to-native) UnityEngine.GameObject.GetComponentFastPath(UnityEngine.GameObject,System.Type,intptr)
at UnityEngine.GameObject.GetComponent[T] () [0x00021] in <97fdf0a75ab94da9a7e5188c186e574d>:0
at HandMiniGame.Plugin.Update () [0x00119] in <6bd10a6628e64a569f2780a44c50b1b4>:0
(Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 35)
what does this mean?
8 Replies
Elmishh
ElmishhOP2y ago
heres the code
Henkypenky
Henkypenky2y ago
from what i can understand it seems that that particular GameObject is destroyed and when you try to get a component from it, it's a null ref the issue is in your Update method probably staticPoints add a check if it's null before
Elmishh
ElmishhOP2y ago
would imagine its staticpoints considering its the part that doesnt work
Elmishh
ElmishhOP2y ago
do you think this would fix it?
Elmishh
ElmishhOP2y ago
foreach (var point in staticPoints)
{
if (point == null)
return;
else
{
foreach (var point in staticPoints)
{
if (point == null)
return;
else
{
was added
Henkypenky
Henkypenky2y ago
i don't know, is a NRE still being thrown?
Elmishh
ElmishhOP2y ago
I can only test tomorrow
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server