This script makes the game drop down from 30 fps to 3 fps. Here they seem to do it no problem(start at 1:00): Intruder Series 002 Concussion Grenades - YouTube
What is making the lag?
#pragma strict
var wake : boolean;
var power : float = 1000;
var damage : int = 1;
var radius : float = 3;
function Start () {
}
function Update () {
if(wake == true) {
Explode();
}
}
function Explode() {
var colliders : Collider[] = Physics.OverlapSphere (transform.position, radius);
Debug.Log("Count of colliders = "+colliders.Length);
for (var collider : Collider in colliders) {
//if (collider.tag == "brick" || collider.tag == "player") {
Debug.Log("Found brick or a player");
var hit : RaycastHit;
if (Physics.Linecast(transform.position, collider.transform.position, hit)) {
if (hit.collider == collider) {
Debug.Log("No obstructions");
if (hit.rigidbody)
hit.rigidbody.AddExplosionForce(power, transform.position, radius, 3.0);
}
}
}
//}
}