Game Development Community

Public List<type> in TorqueComponent causes TXB to crash

by Steve De George · in Torque X 2D · 02/06/2010 (5:46 pm) · 2 replies

When TXB reads the component, it crashes. Can TXB have addons created that tell it how to read types and render UI in the editor for those types?

#1
02/12/2010 (12:44 am)
I ran into a similar problem. It is just with lists of certain items. Most types work fine. Check out my last post in this thread:

www.torquepowered.com/community/forums/viewthread/93913/1#comment-650923

Sorry, never found a fix.

Workaround: Create multiple public properties and combine them into a list in the _OnRegister function. It sucks, but it's what I've been doing since my lists aren't more than a few items.
#2
02/12/2010 (1:28 pm)
You can't mod the TXB UI. But you can make it load stuff as xml types (the platformer kit does it for example, if I remember correctly).

Regarding lists, if List<type> isn't working for the type you want try wrapping the type. For example:

// for static sprite materials
public class XMLRenderMaterial
{
        public RenderMaterial Material
        {
            get { return _material; }
            set { _material = value; }
        }

        RenderMaterial _material;
}

// for animated sprite materials
public class XMLAnimationData
{
        public T2DAnimationData Animation
        {
            get { return _animation; }
            set { _animation = value; }
        }

        T2DAnimationData _animation;
}

Then in your component you would put List<XMLAnimationData>.