0
Under review

Errors on console "NullReferenceException: Object reference not set to an instance of an object _LushLODTree.Update () (at Assets/LushLOD Trees/Scripts/_LushLODTree.cs:1274)"

Trịnh Hải 6 years ago updated by Aaron Brown 6 years ago 2

Dear Aaron! 

I have problem with in a line code when hit play my project! I recorded it in this video below.

Some explains about my project (i'm not coder so i describe not exactly):

- My project about MMO.

- Map Scene is individual. Not included camera when  played. I still create camera when setup Tree Root and bake lightmap. Then i apply to prefab and disable it. The prefab  which contained character and camera will be call in other scene. May it seem quite wreid for u :)

- I think this difference causes to errors. 

- Your asset solved LOD 's tree well and those errors maynot belong your responsibility. But u can firgue it out?

Youtube video


I mean "Quite weird". Sorry about my english !

Under review

You can probably solve this error by adding this line of code:


if (Camera.main == null) return;


So that the code looks like this (line 1273 to 1275):


        //Get the current distance from the camera to this tree. Probably the same as using Vector3.Distance():
        if (Camera.main == null) return;
        curDistance = (curPosition - Camera.main.transform.position).sqrMagnitude;


Adding this line of code should solve the error you are seeing.