SnpM / LockstepFramework

Framework for lockstep RTS, TD, and MOBA games.
MIT License
1.39k stars 348 forks source link

Problem of NullReferenceException #165

Closed JourneyHans closed 5 years ago

JourneyHans commented 5 years ago

I use Unity 2018.2.8f1 and I get an NullReferenceException at ReorderableListControl.cs, line 568:

_visibleRect = GUIHelper.VisibleRect()

I find solution of this bug, it seems like Unity 2018 changed visibleRect's access. At GUIHelper.cs, change

var piVisibleRect = tyGUIClip.GetProperty("visibleRect", BindingFlags.Static | BindingFlags.Public);

to

var piVisibleRect = tyGUIClip.GetProperty("visibleRect", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);

will solve that.

JourneyHans commented 5 years ago

Oh, sorry, there are still one more place should be changed. Still at GUIHelper.cs, change

VisibleRect = (Func<Rect>)Delegate.CreateDelegate(typeof(Func<Rect>), piVisibleRect.GetGetMethod());

to

var getMethod = piVisibleRect.GetGetMethod(true) ?? piVisibleRect.GetGetMethod(false); VisibleRect = (Func<Rect>)Delegate.CreateDelegate(typeof(Func<Rect>), getMethod);

JourneyHans commented 5 years ago

I found solution at here: https://github.com/pbhogan/InControl/pull/217/commits/2198c7de893370d903b16196ffb1261fafe1bf6f

SnpM commented 5 years ago

Consolidating editor-related bugs here: https://github.com/SnpM/LockstepFramework/issues/170