I looked up this here and I got some codes, but I’m getting some errors. Some help please? If it’s something simple I’m missing out do let me know, I’m a little rusty to this.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlatformFall : MonoBehaviour {
public Rigidbody platform;
private bool hasPlayerExited;
float time = 0f;
// Use this for initialization
void Start () {
platform = GetComponent ();
platform.isKinematic = true;
platform.useGravity = false;
platform = gameObject.GetComponent<Rigidbody> ();
}
void OnCollisionEnter () {
hasPlayerExited = false;
}
void OnCollisionExit () {
hasPlayerExited = true;
}
// Update is called once per frame
void Update () {
if (hasPlayerExited == true) {
timer += Time.deltaTime;
if (time > 0.5) {
platform.isKinematic = false;
platform.useGravity = true;
}
}
}
}
*These are my errors:
Using the generic method ‘UnityEngine.Component.GetComponent()’ requires 1 type argument(s)
The name ‘timer’ does not exist in the current context*