using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Explosion : MonoBehaviour
{
public float radius;
public float force;
void Start()
{
Collider[] colliders = Physics.OverlapSphere(transform.position, radius);
foreach(Collider nearbyObject in colliders)
{
Rigidbody rb = nearbyObject.GetComponent<Rigidbody>();
if (rb != null)
{
rb.AddExplosionForce(force, transform.position, radius);
}
}
}
}
Этот скрипт "висит" на взрыве(префаб), который спавнится при условии. Где ошибка?