Jump to content

Error when trying to create a new Sector Chunk


Recommended Posts

Awhile ago I set up the main chunks in my game scene, and that went fine and is working great. Now I am trying to set up another chunk (for a building interior), but no luck. Using Unity 2019.4.34 on Windows.


1) I select the game object/parent with all the interior objects.

2) I do Game Object> Procedural Worlds>SECTR> CORE>Sector

3) That adds the SECTR_Sectr component to the game object, but not the Chunk component....should it?

4) I do Window>Procedural Worlds>SECTR>Stream Window. That shows this interior chunk with an Export button. So I click that Export button.

5) That throws the error below, and instead of exporting the chunk, it creates a new additive scene at the bottom of the scene hierarchy, with the interior parent/child objects in it. It does not create the additive scene and does not put the SECTR_Chunk  script on the parent. 

Any idea what's going wrong and how to make this work?





NullReferenceException: Object reference not set to an instance of an object
SECTR_StreamExport.ExportToChunk (SECTR_Sector sector) (at Assets/Procedural Worlds/SECTR/Scripts/Editor/Stream/SECTR_StreamExport.cs:564)
SECTR_StreamExport.ExportSceneChunks () (at Assets/Procedural Worlds/SECTR/Scripts/Editor/Stream/SECTR_StreamExport.cs:921)
SECTR_StreamExport.ExportSceneChunksUI () (at Assets/Procedural Worlds/SECTR/Scripts/Editor/Stream/SECTR_StreamExport.cs:827)
SECTR_StreamWindow.OnGUI () (at Assets/Procedural Worlds/SECTR/Scripts/Editor/Stream/SECTR_StreamWindow.cs:335)
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at <785fa035f6c842aea795e821898770c6>:0)
UnityEditor.HostView.Invoke (System.String methodName) (at <785fa035f6c842aea795e821898770c6>:0)
UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition, UnityEngine.Rect viewRect) (at <785fa035f6c842aea795e821898770c6>:0)
UnityEditor.DockArea.DrawView (UnityEngine.Rect viewRect, UnityEngine.Rect dockAreaRect) (at <785fa035f6c842aea795e821898770c6>:0)
UnityEditor.DockArea.OldOnGUI () (at <785fa035f6c842aea795e821898770c6>:0)
UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <cb39c3d61d484a1d9d85158bfe5b2e83>:0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <cb39c3d61d484a1d9d85158bfe5b2e83>:0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <cb39c3d61d484a1d9d85158bfe5b2e83>:0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Boolean canAffectFocus) (at <cb39c3d61d484a1d9d85158bfe5b2e83>:0)
UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUI (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus) (at <cb39c3d61d484a1d9d85158bfe5b2e83>:0)
UnityEngine.UIElements.IMGUIContainer.HandleEvent (UnityEngine.UIElements.EventBase evt) (at <cb39c3d61d484a1d9d85158bfe5b2e83>:0)
UnityEngine.UIElements.CallbackEventHandler.HandleEventAtTargetPhase (UnityEngine.UIElements.EventBase evt) (at <cb39c3d61d484a1d9d85158bfe5b2e83>:0)
UnityEngine.UIElements.MouseCaptureDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <cb39c3d61d484a1d9d85158bfe5b2e83>:0)
UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) (at <cb39c3d61d484a1d9d85158bfe5b2e83>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <cb39c3d61d484a1d9d85158bfe5b2e83>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEventQueue () (at <cb39c3d61d484a1d9d85158bfe5b2e83>:0)
UnityEngine.UIElements.EventDispatcher.OpenGate () (at <cb39c3d61d484a1d9d85158bfe5b2e83>:0)
UnityEngine.UIElements.EventDispatcherGate.Dispose () (at <cb39c3d61d484a1d9d85158bfe5b2e83>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <cb39c3d61d484a1d9d85158bfe5b2e83>:0)
UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at <cb39c3d61d484a1d9d85158bfe5b2e83>:0)
UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at <cb39c3d61d484a1d9d85158bfe5b2e83>:0)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at <cb39c3d61d484a1d9d85158bfe5b2e83>:0)
UnityEngine.UIElements.UIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <cb39c3d61d484a1d9d85158bfe5b2e83>:0)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <c6fb44a03db64bd4a43ea88cab15457f>:0)

Link to comment
Share on other sites

Hi @gecko64,

I looked into this error and it is a bit strange: It is correct that the SECTR_Chunk component is not on the sector object yet, that would only be added on the first export of the sector. What puzzles me though is the error message - the error points at a line in the code that seems like the target game object that is going to receive the data / objects from the original object is suddenly missing inbetween - but there should be no reason for it to disappear all the sudden.
Are there by any chance scripts on the objects that are about to be exported that might do things like delete themselves or their parent for any (gameplay) reason?
Are you familiar with scripting / debugging? It would be extremly helpful to debug from 
SECTR_StreamExport.cs line 564 and onward to see if I'm correct with my assumption that the target object is disappearing in the middle of the export.
Does exporting work for you in a new scene with just a few dummy sample objects (e.g. Unity's default cubes)?
If the above does not bring any improvement, is there a chance you could send us your project as a .zip file so we can have a look? I can provide a possibility for the upload. If this is out of the question then we can continue analysis in other ways, but it can be difficult for us to find something if we can't reproduce the error ourselves.

Link to comment
Share on other sites

  • 1 month later...

Urgh, so actually yeah, one of our devs had edited a SECTR script to spread out the loading process, and that was causing the error. Fixed!


So now I have the new chunk exported, and I created a Trigger Loader (box collider with isTrigger checked, and SECTR trigger loader component with that new chunk assigned to it) -- but at runtime, the chunk is loaded using the Region loader, not with the trigger loader. Is there something else I need to do to make it respect the trigger loader?

Link to comment
Share on other sites

Not sure what you mean by trigger loader? 
Are you talking about the start loader, neighbor loader, or something in the region loader? 
If you are talking about the region loader, make sure your layers are setup correctly. 
Then make sure that you unload the terrain chunks after adding them to the build settings. 

Link to comment
Share on other sites

I mean the Trigger Loader mentioned in the documentation, page 34:


Trigger Loader

This component lets you load a list of Sectors whenever a particular Unity Trigger is activated. These same Sectors will be unloaded whenever the trigger is deactivated (provided no one else is trying to load them)




Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Tell a friend

    Love Canopy - Procedural Worlds? Tell a friend!
  • Need help?

    We work with some of the biggest brands in global gaming, automotive, technology, and government to create environments, games, simulations, and product launches for desktop, mobile, and VR.

    Our unique expertise and technology enable us to deliver solutions that look and run better at a fraction of the time and cost of a typical project.

    Check out some of our non-NDA work in the Gallery, and then Contact Us to accelerate your next project!

  • Create New...