Game Development Community

Bug? in T2DSpawnObject.DoSpawn

by Scott Goodwin · in Torque X 2D · 05/14/2008 (5:34 pm) · 0 replies

The name assigned to a T2DSpawnObject in TXB doesn't get assigned to the scene object.
This can be fixed by adding the line of code given below.

public void DoSpawn()
        {
            if (_spawnTemplate != null)
            {
                // clone the template and register it with the object database
                T2DSceneObject sceneObject = (T2DSceneObject)_spawnTemplate.Clone();
                sceneObject.Position = Position;
                sceneObject.Rotation = Rotation;
                sceneObject.Size = Size;
 
                #region CODE ADDED(SDG)
#if SDG_APPLY_CODE_CHANGES
                sceneObject.Name = Name;
#endif
                #endregion
 
                Manager.Register(sceneObject);
            }
        }