Unity 5.5 obsolete particle system code

particle.startLifetime: First of all, what Unity did in Unity 5.5 was to add new futures to the ParticleSystem. They also exposed some ParticleSystem API that was hidden before. ParticleSystem.MainModule.startLifetime is now a type of MinMaxCurve instead of float like ParticleSystem.startLifetime. By doing this, you are now given more options such as modifying the startLifetime as … Read more

Unity – Checking if the player is grounded not working

Do not use OnTriggerStay to do this. That’s not guaranteed to be true very time. Set isGrounded flag to true when OnCollisionEnter is called. Set it to false when OnCollisionExit is called. bool isGrounded = true; private float jumpForce = 2f; private Rigidbody pRigidBody; void Start() { pRigidBody = GetComponent<Rigidbody>(); } private void Update() { … Read more

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>()

How do extension methods work?

First, here’s a very quick tutorial on extensions for those learning c#/Unity for anyone googling here: Make a new text file HandyExtensions.cs like this … (note that somewhat confusingly, you can use any name at all for the class which “holds” your extensions – the actual name of the class is never used at all, … Read more

More organized way to call Coroutines?

This is very straightforward. Just use yield return SecondRequest(); or yield return StartCoroutine( SecondRequest());. The yield before the the coroutine name or StartCoroutine should make it wait for that coroutine to return before it continue to execute other code below it. For example, you have four coroutine functions that should be called sequentially: IEnumerator FirstRequest() … Read more