Skip to content

Commit 468d281

Browse files
committed
Merge remote-tracking branch 'origin/master' into feature/agx-lidar
2 parents 1e79b24 + e162227 commit 468d281

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

Diff for: AGXUnity/WireRoute.cs

+12-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace AGXUnity
1818
/// Wire.RouteNode myNode = route.FirstOrDefault( node => node.Frame == thisFrame );
1919
/// </example>
2020
[Serializable]
21-
public class WireRoute : Route<WireRouteNode>
21+
public class WireRoute : Route<WireRouteNode>, ISerializationCallbackReceiver
2222
{
2323
/// <summary>
2424
/// Checks validity of current route.
@@ -177,5 +177,16 @@ private void OnRemovedFromList( WireRouteNode node, int index )
177177
{
178178
node.Wire = null;
179179
}
180+
181+
public void OnBeforeSerialize() { }
182+
183+
public void OnAfterDeserialize()
184+
{
185+
// Remove callback if it exists to avoid any possible duplicates
186+
OnNodeAdded -= this.OnAddedToList;
187+
OnNodeRemoved -= this.OnRemovedFromList;
188+
OnNodeAdded += this.OnAddedToList;
189+
OnNodeRemoved += this.OnRemovedFromList;
190+
}
180191
}
181192
}

Diff for: Editor/AGXUnityEditor/PatchHelper.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public static void ApplyPatches()
9191
HandlePrefabPath( prefabs[ i ] );
9292
}
9393

94-
var scenes = AssetDatabase.FindAssets( "t:scene" ).Select(guid => AssetDatabase.GUIDToAssetPath( guid ) ).ToArray();
94+
var scenes = AssetDatabase.FindAssets( "t:scene" ).Select(guid => AssetDatabase.GUIDToAssetPath( guid ) ).Where(p => !p.StartsWith("Packages")).ToArray();
9595
var setup = EditorSceneManager.GetSceneManagerSetup();
9696
for ( int i = 0; i < scenes.Length; i++ ) {
9797
EditorUtility.DisplayProgressBar( "Patching objects to 5.2.0", "Patching Scenes...", (float)i / scenes.Length );
@@ -228,7 +228,7 @@ private static void MigrateMassProperties( AGXUnity.Deprecated.MassProperties ol
228228
{
229229
if ( oldMP != null ) {
230230
var rb = oldMP.RigidBody;
231-
if ( !ShouldPatch ) return;
231+
if ( rb == null || !ShouldPatch ) return;
232232
CopyDefaultAndUserValue( oldMP.Mass, rb.MassProperties.Mass );
233233
CopyDefaultAndUserValue( oldMP.InertiaDiagonal, rb.MassProperties.InertiaDiagonal );
234234
CopyDefaultAndUserValue( oldMP.InertiaOffDiagonal, rb.MassProperties.InertiaOffDiagonal );

0 commit comments

Comments
 (0)