Skip to content

Commit

Permalink
Now SetDirty will only be called in the editor
Browse files Browse the repository at this point in the history
  • Loading branch information
jadvrodrigues committed Dec 18, 2020
1 parent c0faf1b commit e0512db
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Assets/CustomNavMesh/Scripts/CustomNavMeshAgent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -504,9 +504,12 @@ void TryCreatingHiddenAgent()
hiddenObject.isStatic = gameObject.isStatic;
#endif
HiddenAgent = hiddenObject.AddComponent<HiddenNavMeshAgent>();

#if UNITY_EDITOR
// set dirty; otherwise, if it's part of a prefab instance and scripts are
// reloaded, the hiddenAgentGameObject reference will be lost
EditorUtility.SetDirty(this);
#endif

HiddenAgent.LinkWithCustomAgent(this);
}
Expand Down

0 comments on commit e0512db

Please sign in to comment.