Fatal error! What happened?
I am attempting to have asteroids (which spawn randomly) delete from the world after they hit a certain boundary. It was working fine a week ago and now that I changed it from -10 to -20 it crashes Unity no matter what I have the boundary set at, pegs the RAM, and gives the Unity error "Fatal Error! Size overflow in allocator." My player code is an exact mirror and it works correctly, so that confused me even further. I don't know if it is something I did with C# (not my native language) or if I am doing something Unity doesn't like. If anyone knows what this error means or has a possible solution please let me know! I only found one article on this and it was never answered. Here is the code associated with it.
using UnityEngine;
using System.Collections;
public class Enemy : MonoBehaviour
{
public Transform astroid;
public int fallBoundaryE = -20;
public void Update()
{
if (transform.position.y <= fallBoundaryE)
{
GameMaster.KillEnemy(this);
}
}
}
This is the code it calls from GameMaster
using UnityEngine;
using System.Collections;
public class GameMaster : MonoBehaviour {
public static void KillPlayer(Player player)
{
Destroy(player.gameObject);
}
public static void KillEnemy(Enemy astroid)
{
Destroy(astroid.gameObject);
}
}
What is it that is making you think this code is the source of the problem?