I’m getting an exception that only happens in a build. This is using astarpathfindingproject_master_pro_dev_4_3_28_fa68888e.unitypackage
I am not using IL2CPP
Unity 2019.3.15f1
ArgumentException: An item with the same key has already been added. Key: PM_Stool_1A (NavmeshCut2)
at System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) [0x000c1] in <c79628fadf574d3a8feae0871fad28ef>:0
at System.Collections.Generic.Dictionary`2[TKey,TValue].Add (TKey key, TValue value) [0x00000] in <c79628fadf574d3a8feae0871fad28ef>:0
at Pathfinding.Util.GridLookup`1[T].Add (T item, Pathfinding.IntRect bounds) [0x0004a] in <3ded99942e1c4854b0d9c7c6b5f07db9>:0
at Pathfinding.NavmeshUpdates+NavmeshUpdateSettings.AddClipper (Pathfinding.NavmeshClipper obj) [0x00039] in <3ded99942e1c4854b0d9c7c6b5f07db9>:0
at Pathfinding.NavmeshUpdates.HandleOnEnableCallback (Pathfinding.NavmeshClipper obj) [0x0001f] in <3ded99942e1c4854b0d9c7c6b5f07db9>:0
at (wrapper delegate-invoke) System.Action`1[Pathfinding.NavmeshClipper].invoke_void_T(Pathfinding.NavmeshClipper)
at Pathfinding.NavmeshClipper.OnEnable () [0x00017] in <3ded99942e1c4854b0d9c7c6b5f07db9>:0
UnityEngine.GameObject:Internal_AddComponentWithType(Type)
UnityEngine.GameObject:AddComponent(Type)
UnityEngine.GameObject:AddComponent()
ModV1.Source.Utility_Common:CreateOrGetComponent(GameObject, Boolean&)
NavmeshCutUpdater:ProcessPhase3Complete()
NavmeshCutUpdater:OnPhase3Complete(Object, InterruptableEventArgs)
ModV1.Source.InterruptableEvent`1:Invoke(Object, TriggerableVariableChange)
ModV1.Source.TriggerableVariable`1:TriggerVariableChanged()
ModV1.Source.TriggerableVariable`1:Set(Boolean)
<>c__DisplayClass72_0:<OnAvatarSceneLoadFinished3>b__0(List`1)
ModV1.Source.AssetManager2.AM2Loader:ExecuteAsync(PrehashedString[], UnityAction`1)
GameSystem:ExecuteAsync(PrehashedString[], UnityAction`1)
AnyModeState:OnAvatarSceneLoadFinished3(List`1, List`1, String, Boolean, Boolean)
<SetSceneReadyForGameplay>d__68:MoveNext()
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
(Filename: <c79628fadf574d3a8feae0871fad28ef> Line: 0)
A bunch of these, followed by
PointOnEdgeException, perturbating vertices slightly.
This is usually fine. It happens sometimes because of rounding errors. Cutting will be retried a few more times.
(Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 35)
PointOnEdgeException, perturbating vertices slightly.
This is usually fine. It happens sometimes because of rounding errors. Cutting will be retried a few more times.
(Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 35)
PointOnEdgeException, perturbating vertices slightly.
This is usually fine. It happens sometimes because of rounding errors. Cutting will be retried a few more times.
(Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 35)
NullReferenceException
at (wrapper managed-to-native) UnityEngine.Transform.get_position_Injected(UnityEngine.Transform,UnityEngine.Vector3&)
at UnityEngine.Transform.get_position () [0x00000] in <97fdf0a75ab94da9a7e5188c186e574d>:0
at NavmeshCut2.RequiresUpdate (Pathfinding.Util.GridLookup`1+Root[T] previousState) [0x00000] in <0dbc5c4161324de1b71c937551a2259b>:0
at Pathfinding.NavmeshUpdates.ForceUpdate () [0x000db] in <3ded99942e1c4854b0d9c7c6b5f07db9>:0
at Pathfinding.NavmeshUpdates.Update () [0x0007f] in <3ded99942e1c4854b0d9c7c6b5f07db9>:0
at AstarPath.Update () [0x00008] in <3ded99942e1c4854b0d9c7c6b5f07db9>:0
(Filename: <97fdf0a75ab94da9a7e5188c186e574d> Line: 0)
NullReferenceException
at (wrapper managed-to-native) UnityEngine.Transform.get_position_Injected(UnityEngine.Transform,UnityEngine.Vector3&)
at UnityEngine.Transform.get_position () [0x00000] in <97fdf0a75ab94da9a7e5188c186e574d>:0
at NavmeshCut2.RequiresUpdate (Pathfinding.Util.GridLookup`1+Root[T] previousState) [0x00000] in <0dbc5c4161324de1b71c937551a2259b>:0
at Pathfinding.NavmeshUpdates.ForceUpdate () [0x0007a] in <3ded99942e1c4854b0d9c7c6b5f07db9>:0
at Pathfinding.NavmeshUpdates.Update () [0x0007f] in <3ded99942e1c4854b0d9c7c6b5f07db9>:0
at AstarPath.Update () [0x00008] in <3ded99942e1c4854b0d9c7c6b5f07db9>:0
(Filename: <97fdf0a75ab94da9a7e5188c186e574d> Line: 0)
This is NavmeshCut2
public class NavmeshCut2 : Pathfinding.NavmeshCut
{
public override bool RequiresUpdate(Pathfinding.Util.GridLookup<NavmeshClipper>.Root previousState)
{
// https://forum.arongranberg.com/t/navmeshcut-reduces-fps-to-8/8859/3
return tr.position.y > -10.0f && base.RequiresUpdate(previousState);
}
}
I made an earlier change to NavMeshCut.OnDisable that was probably related
protected virtual void OnDisable () {
// KevinJ: Fix crash
if (all.Count > 0)
{
// Efficient removal (the list doesn't need to be ordered).
// Move the last item in the list to the slot occupied by this item
// and then remove the last slot.
all[listIndex] = all[all.Count - 1];
all[listIndex].listIndex = listIndex;
all.RemoveAt(all.Count - 1);
listIndex = -1;
}
if (OnDisableCallback != null) OnDisableCallback(this);
}
I noticed in MeshMeshCut.cs you have this static:
static readonly List all = new List();
However you are not resetting this as follows:
static List<NavmeshClipper> all = new List<NavmeshClipper>();
int listIndex = -1;
// KevinJ:
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
static public void SubsystemRegistrationInit()
{
all = new List<NavmeshClipper>();
}
This is most likely why it crashed in OnDisable