So I have code here and in the console the error says:
- The best overload method match for 'UnityEngine.WaitForSeconds(float)' has some invalid arguments
- Argument '#1' cannot convert 'double' expression to type 'float'
public class FloatDown : MonoBehaviour {
public bool gravity = false;
// Use this for initialization
void Start () {
rigidbody2D.gravityScale = 0;
}
IEnumerator grav(){
if (gravity == true) {
yield return new WaitForSeconds(0.5);
rigidbody2D.gravityScale = 0;
gravity = false;
}
}
void OnCollisionEnter2D(Collision2D coll) {
if (coll.gameObject.tag == "Wall") {
rigidbody2D.gravityScale = 0.5f;
gravity = true;
StartCoroutine( grav() );
}
}
}
If you could help me, it would be very much appreciated. Thanks!