SmartlyDressedGames / Unturned-3.x-Community

Community portion of the Unturned-3.x repo. If you have access to the source code you can find it here:
https://github.com/SmartlyDressedGames/Unturned-3.x/
88 stars 18 forks source link

3.24.6.0 breaks any resource dats with SpeedTree in them #4749

Open asineth0 opened 1 month ago

asineth0 commented 1 month ago

On the new update, if you load up a map that has resources that are still considered "SpeedTrees" you get an exception and the game hangs at 15.79% attempting to load into the map. A workaround is possible by removing SpeedTree from the resource dat files, which resolves the issue.

Exception from Client.log:

[2024-10-18 10:11:26] NullReferenceException: Object reference not set to an instance of an object
[2024-10-18 10:11:26] SDG.Unturned.ResourceSpawnpoint..ctor (System.Byte newType, System.UInt16 newID, System.Guid newGuid, UnityEngine.Vector3 newPoint, System.Boolean newGenerated, SDG.Unturned.NetId netId) (at <059d62fbc9254f6097304c7b266a5535>:0)
SDG.Unturned.ResourceSpawnpoint..ctor (System.UInt16 newID, System.Guid guid, UnityEngine.Vector3 newPoint, System.Boolean newGenerated, SDG.Unturned.NetId netId) (at <059d62fbc9254f6097304c7b266a5535>:0)
SDG.Unturned.LevelGround.loadTrees () (at <059d62fbc9254f6097304c7b266a5535>:0)
SDG.Unturned.LevelGround.load (System.UInt16 size) (at <059d62fbc9254f6097304c7b266a5535>:0)
SDG.Unturned.Level+<init>d__149.MoveNext () (at <059d62fbc9254f6097304c7b266a5535>:0)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <fcaf289839f24125a059795f150fce14>:0)

While yes, I know SpeedTrees are no longer supported, this should ideally be fixed so that old resources and maps can work on the newer versions without having to update them or resort to hacky workarounds.

SDGNelson commented 1 month ago

That's weird! Sorry about this. The SpeedTree flag isn't checked in the code anymore so I'm not sure what's causing the exception. Is it a map I could load up to test?

asineth0 commented 1 month ago

That's weird! Sorry about this. The SpeedTree flag isn't checked in the code anymore so I'm not sure what's causing the exception. Is it a map I could load up to test?

It could also be "Auto_Skybox" in the resource .dat files that is causing the exception during load. The map that's experiencing this is Butter_Finger's custom map and so I told him to try a couple things at once and we fixed it, we went back and checked exactly what we changed and it's "Auto_Skybox" and "SpeedTree" that we removed.

He also mentioned that baking foliage is apparently broken now? It seems to affect all foliage/trees, nothing bakes and no progress % shows up. I'll try and get more details if possible but I'm not sure if that helps you here by mentioning that.

asineth0 commented 1 month ago

Error while attempting to baking foliage (can open as separate issue if you want):

[2024-10-19 03:16:32] NullReferenceException: Object reference not set to an instance of an object
[2024-10-19 03:16:32] SDG.Framework.Foliage.FoliageSurfaceComponent.getFoliageSurfaceBounds () (at <09e85ba5f9544deeb2b1edf9972661da>:0)
SDG.Framework.Foliage.FoliageSystem.getTileSurfacePairs () (at <09e85ba5f9544deeb2b1edf9972661da>:0)
SDG.Framework.Foliage.FoliageSystem.bakeLocalBegin () (at <09e85ba5f9544deeb2b1edf9972661da>:0)
SDG.Framework.Foliage.FoliageSystem.bakeLocal (SDG.Framework.Foliage.FoliageBakeSettings bakeSettings) (at <09e85ba5f9544deeb2b1edf9972661da>:0)
SDG.Unturned.EditorTerrainDetailsUI.OnBakeLocalButtonClicked (SDG.Unturned.ISleekElement button) (at <09e85ba5f9544deeb2b1edf9972661da>:0)
SDG.Unturned.GlazierButton_uGUI.OnUnityButtonClicked () (at <09e85ba5f9544deeb2b1edf9972661da>:0)
UnityEngine.Events.InvokableCall.Invoke () (at <fcaf289839f24125a059795f150fce14>:0)
UnityEngine.Events.UnityEvent.Invoke () (at <fcaf289839f24125a059795f150fce14>:0)
UnityEngine.UI.Button.Press () (at <87b30404fa804ca2b102dbbfde9f9b64>:0)
UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at <87b30404fa804ca2b102dbbfde9f9b64>:0)
SDG.Unturned.ButtonEx.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at <09e85ba5f9544deeb2b1edf9972661da>:0)
UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at <87b30404fa804ca2b102dbbfde9f9b64>:0)
UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1] functor) (at <87b30404fa804ca2b102dbbfde9f9b64>:0)
UnityEngine.EventSystems.EventSystem:Update()
SDGNelson commented 1 month ago

Hmm Auto_Skybox should only affect asset loading during startup. It generates the skybox version of the model then, not when loading the level.

It looks like the reason getFoliageSurfaceBounds would throw an exception is if the object didn't have a collider. Maybe "Foliage" is specified on an object without a collider?