Unity 4.0 Crashes without reason

It always crashes every 20 seconds during the gameplay. I also check all the code by deactivating them to find what is the problem.

I checked all, and it still crashes every 20 seconds. I didn’t make any changes today, yesterday, my Unity is fine.

When it start crashes, i check the taskmanager, and it says Unity used 394,000MB (4GB DDR3 installed, 3GB usable) of memory and 25% cpu usage (Intel Corei3)

please help me.

thanks.

Maybe you have something currupted, or you have a big fail in your code that make the process overload.

–

you can try updating Unity , though i doubt it will help... I'm unsure what you code even does..(lap1?, nextwaypoint?) only that it has to do with racing. If you tried what I said above with no improvement then the only thing i can think of left is to rely on Bug Reports.

–

1 Answer

1

Last time i check, this was the problem of Unity’s crash!

function OnCollisionEnter(col : Collision){
	if(!moveNow && useTranslator && rigidbody && onColliderGo){
		moveNow = true;
		Destroy(rigidbody);
		useTranslator = true;
	}

	if(explosionType == ExplosiveTypes.TNT){
		if(col.gameObject.tag == "Player"){
			col.transform.root.GetComponent(Kart).PlantTNT(gameObject);
			isTNT = true;
		}
		if(col.gameObject.tag == "Opponent"){	
			col.transform.root.GetComponent(AIKart).PlantTNT(gameObject);
			isTNT = true;
		}
	}else if(explosionType == ExplosiveTypes.Nitro){
		if(col.gameObject.tag == "Player" || col.gameObject.tag == "Opponent")Explode();
	}
	else if(explosionType == ExplosiveTypes.Other){
		if(col.gameObject.tag == "Player" || col.gameObject.tag == "Opponent" || col.gameObject.tag == specialTag)Explode();
	}
	else if(explosionType == ExplosiveTypes.Ice){
		if(col.gameObject.tag == "Player" || col.gameObject.tag == "Opponent")FreezeMe(col.gameObject);
	}
	else if(explosionType == ExplosiveTypes.FryingPan){
		if(col.gameObject.tag == "Player" || col.gameObject.tag == "Opponent" || col.gameObject.tag == specialTag){
			if(powerPan) StopMe(col.gameObject,5);
			else StopMe(col.gameObject, 1);
		}
	}
	else if(explosionType == ExplosiveTypes.BouncyJr){
		if(col.gameObject.tag == "Player" || col.gameObject.tag == "Opponent" || col.gameObject.tag == "Environtment"){
			if(bouncyJrCounter > 10) Explode();
			else bouncyJrCounter ++;
		}
	}
	else if(explosionType == ExplosiveTypes.Cake){
		if(col.gameObject.tag == "Player" || col.gameObject.tag == "Opponent")StickMe(col.gameObject);
	}
}

function OnTriggerEnter(col : Collider){
	if(explosionType == ExplosiveTypes.Glue){
		if(col.gameObject.tag == "Player" || col.gameObject.tag == "Opponent")GlueMe(col.gameObject,powerGlue);
	}
	if(explosionType == ExplosiveTypes.Oil){
		if(col.gameObject.tag == "Player" || col.gameObject.tag == "Opponent")SpinMe(col.gameObject);
	}
}