You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Great library! I've adapted it to a 3d project with movement along the x and z axes and it's working beautifully--but there's a major oversight when it comes to rigidbodies that have been destroyed after being added to the NearSensor's hashset.
I tried implementing a solution within the NearSensor script to first check if the rigidbody exists and is enabled before adding to the hashset--but that didn't address the case in which rigidbodies are destroyed after being added (such as when an enemy is killed). Cohesion, Separation, VelocityMatch and CollisionAvoidance were still trying to access the destroyed rigidbody, throwing null exceptions every frame.
I would suggest, in NearSensor-dependent scripts, at the beginning of the foreach loop iterating over members of the rigidbody hashset, to make it first check if the rigidbody at this index is null before accessing it. When I added this check, there were no more errors.
(P.S. I'd be happy to submit a pull request if you'd like to see the various tweaks I made to add this library to my project!)
The text was updated successfully, but these errors were encountered:
Great library! I've adapted it to a 3d project with movement along the x and z axes and it's working beautifully--but there's a major oversight when it comes to rigidbodies that have been destroyed after being added to the NearSensor's hashset.
I tried implementing a solution within the NearSensor script to first check if the rigidbody exists and is enabled before adding to the hashset--but that didn't address the case in which rigidbodies are destroyed after being added (such as when an enemy is killed). Cohesion, Separation, VelocityMatch and CollisionAvoidance were still trying to access the destroyed rigidbody, throwing null exceptions every frame.
I would suggest, in NearSensor-dependent scripts, at the beginning of the foreach loop iterating over members of the rigidbody hashset, to make it first check if the rigidbody at this index is null before accessing it. When I added this check, there were no more errors.
(P.S. I'd be happy to submit a pull request if you'd like to see the various tweaks I made to add this library to my project!)
The text was updated successfully, but these errors were encountered: