Hi, I’m new to unity and have been trying to create a simple 2D platformer. I am trying to create a block that falls after a delay triggered by touching the player. I attempted to create a script based on things I found online and my own knowledge. I think my code works with exception to the CS0131 error.
Please assist in solving the CS0131 error or give suggestions to improve my code.
Thanks
Code:
using UnityEngine;
using System.Collections;
public class DelayGrav : MonoBehaviour
{
public float delay = 1f;
private float timer = 0f;
void Start ()
{
}
void Update ()
{
}
void OnColliderHit (Collider other)
{
timer += Time.deltaTime;
if (timer > delay)
RigidbodyConstraints2D.FreezePositionY = false;
}
}