Declaring a new instance of a class in C#

Pretty easy to google…

http://forum.unity3d.com/threads/119537-You-are-trying-to-create-a-MonoBehaviour-using-the-new-keyword

It’s to do with what Boids inherits. New is apparently not the correct way to instantiate the object, it should be instatiated using the unity framework

gameObject.AddComponent<Boids>()

Leave a Comment