Upon dying, I have a Vector2 Deathkick set to 10f, 10f. However, I would like to be able to have this value a little bit more random, within certain parameters. I'm unsure on how to set this, any help would be appreciated!
For anyone curious, I used the following code in order to get this to work: IEnumerator Die() { if (myBodyCollider.IsTouchingLayers(LayerMask.GetMask("enemy", "harmfulObjects"))) { Vector2 deathKick = new Vector2(UnityEngine.Random.Range(-10f, 10f), UnityEngine.Random.Range(10f, 10f)); isAlive = false; myAnimator.SetTrigger("Die"); GetComponent<Rigidbody2D>().velocity = deathKick; yield return new WaitForSeconds(1.5f); FindObjectOfType<GameSession>().ProcessPlayerDeath(); } It should also be noted that I do not believe I'm allowed to serialize a random variable, therefore I moved the variable within my "Die" Coroutine.