sturdyspoon / unity-movement-ai

A Unity library for common movement AI
MIT License
1.95k stars 280 forks source link

flocking issues - Screen boundry #2

Open phpchess opened 8 years ago

phpchess commented 8 years ago

MissingComponentException: There is no 'Rigidbody' attached to the "ScreenBoundary" game object, but a script is trying to access it. You probably need to add a Rigidbody to the game object "ScreenBoundary". Or your script needs to check if the component is attached before using it. UnityEngine.Rigidbody.get_position () (at C:/buildslave/unity/build/artifacts/generated/common/modules/Physics/DynamicsBindings.gen.cs:1536) Cohesion.getSteering (ICollection`1 targets) (at Assets/unity-movement-ai/Scripts/Movement/Cohesion.cs:28) FlockingUnit.Update () (at Assets/unity-movement-ai/Scripts/FlockingUnit.cs:35)

No such issue exists for other Example scenes. I am using unity 5.3.4

sturdyspoon commented 8 years ago

Are you using ScreenBoundary inside of your own project? I think the master branch version of unity-movement-ai relies on Physics project settings to make sure the screen boundary is not sensed.

In the dev branch (which is vastly different from the master branch) I have made my code just ignore any collider without a MovementAIRigidbody (which is basically just a wrapper class for the library to be able to work with Rigidbody2Dand Unity's 3D Rigidbody).