Game Development Community

Particles cause the game to crash [Fix Inside]

by Giuseppe De Francesco · in Torque X 2D · 12/30/2009 (3:26 pm) · 2 replies

Using very short life in particles and generating them in high quantity cause the engine to crash.

This is my fix:

In the ResourceManager.cs find the Struct Resource<T> and change this

public T Instance
        {
            get { return _resource.Instance; }
        }

in this way:

public T Instance
        {
            get
            {
                if (_resource != null)
                    return _resource.Instance;
                else
                    return default(T);
            }
        }

About the author

In the software eng. field since 1981, in charge of R&D during last 10 years. IEEE Senior Member (and volunteer).


#1
12/31/2009 (12:46 am)
Are you running in 1080? There is a know issue with using 1080 on the xbox that causes lots of crashing.
#2
12/31/2009 (3:38 pm)
Hi Henry,

no, this happens at any resolution (also on the PC) when the particles are a lot and having a quite short life. When the engine reaches that method the _resource has been disposed already (too quickly) so it's null. The above fix solves the issue and the game runs smoothly.