error = Assets\Scripts\Granade.cs(51,43): error CS1061: ‘Collider’ does not contain a definition for ‘GetComponet’ and no accessible extension method ‘GetComponet’ accepting a first argument of type ‘Collider’ could be found (are you missing a using directive or an assembly reference?)
so I was making a basic grenade script and while testing I get this error
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Granade: MonoBehaviour
{
public float delay;
public float[] Radius;
public float Force;
private float CountdownDelay;
private bool Exploded = false;
public GameObject EP;
private Collider[] collider;
// Start is called before the first frame update
void Start()
{
CountdownDelay = delay;
}
// Update is called once per frame
void Update()
{
CountdownDelay -= Time.deltaTime;
if(CountdownDelay <= 0 && !Exploded)
{
Explode();
Exploded = true;
}
}
void Explode()
{
Instantiate(EP, transform.position, transform.rotation);
foreach (float radius in Radius)
{
collider = Physics.OverlapSphere(transform.position, radius);
foreach(Collider nearObject in collider)
{
Rigidbody RB = nearObject.GetComponet<Rigidbody>();
if (RB != null)
{
RB.AddExplosionForce(Force, transform.position, radius);
}
}
}
Destroy(gameObject);
}
}
this is my codes
what I should do?