private void SpawnSnowflake() { transform.position = new Vector3(Random.Range(xMinLeft, xMaxLeft), yPos, 0); float snowflakeSize = Random.Range(snowflakeMinSize, snowflakeMaxSize); snowflakePrefab.GetComponent <Transform>().localScale = new Vector3(snowflakeSize, snowflakeSize, 0); Snowflake clone = (Snowflake)Instantiate(snowflakePrefab, transform.position, transform.rotation); clone.GetComponent <SpriteRenderer>().sortingOrder = Random.Range(2, 8); if (clone.GetComponent <SpriteRenderer>().sortingOrder == 7) { clone.GetComponent <SpriteRenderer>().color = Color.blue; } clone.GetComponent <Rigidbody2D>().velocity = new Vector2(Random.Range(-2, 2), Random.Range(-10, -1)); }