A singleton is a SimObject
instance that we only ever want one instance of. Typically we use singletons for shader objects, materials, and some audio objects. In this recipe we will learn how to create an object as a singleton.
Creating a singleton is straight forward. Here we will create a Material
singleton, one of a number of SimObject
classes that may be created as a singleton, as follows:
singleton Material(DECAL_scorch) { baseTex[0] = "./scorch_decal.png"; translucent = true; translucentBlendOp = None; translucentZWrite = true; alphaTest = true; alphaRef = 84; };