Changing a T2DStaticSprite Material
by Tony Pitman · in Torque X 2D · 07/16/2009 (10:15 pm) · 3 replies
How can I change a T2DStaticSprite material in code at run time? I tried changing the Material.Name to the new material name and nothing happens.
#2
07/17/2009 (5:03 am)
If you just want to apply a named, standard material (i.e one that the scene editor creates), then you can grab it from the object database and assign it to the Material property of the sprite object.mySpriteObject.Material = TorqueObjectDatabase.Instance.FindObject<RenderMaterial>("AnotherMaterial");
#3
07/17/2009 (6:13 am)
Thank you both for your answers. The second one is what I needed....
Torque Owner Christian Rousselle
Default Studio Name
I do this in the _OnRegister method of a component.