unitycoder/UnityPointCloudViewer

NullReferenceException

nvoelzow opened this issue · 8 comments

Every now and then when trying to load large portions of high resolution point clouds I will get this error when using the (original) PointCloudViewerTilesDX11 :

NullReferenceException: Object reference not set to an instance of an object
UnityLibrary.MainThread+d__12.MoveNext () (at Assets/PointCloudTools/PointCloudViewerDX11/Scripts/Common/MainThread.cs:74)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at :0)

after this happens no more tiles will be loaded until I restart the Component.

Unfortunately it only happens from time to time, so it's not exactly easy to track down...

ok adding to things to check list, i remember seeing this few times, but thought that it was fixed by those while-loops after CallInitBuffers line, to make sure they are ready.

same issue, The only way is Restart my app.

aha, i'll need to check more.. which unity version, and do you have [x] use native arrays, and [x] release tile memory enabled? (just wondering if its related to those)

ok, does it happen mostly in the build, less in editor?

one thing that you can test (*or email me, so i'll send updated test script)

  • open PointCloudViewerTilesDX11.cs
  • Find IEnumerator InitDX11BufferA() and IEnumerator InitDX11BufferB()
  • Add try-catches inside that method (except cannot add lines with ".. yield return 0;" inside those try catch, so 3 separate try catches, to catch them all!
  • Then run build, if error happens, its most likely in those parts, and might get more info in player.log (or in editor, if happens there)

example, inside InitDX11BufferA()
1st trycatch:
image

2nd
image

3rd
image

I test my proj mostly in editor,so i am not sure which one happens a lot.
And i will test try-catches to get more info.

MainThread code has had updates, more in v2.80, should help with some null ref issues.