Changes

Jump to navigation Jump to search
46 bytes added ,  15:04, 6 February 2020
Line 128: Line 128:     
=== Components ===
 
=== Components ===
Other than the elements described so far, all tables added to the root table are interpreted as Unity MonoBehaviour components. If you added a table called '''BoxCollider''', the children records would be interpreted as variables of the BoxCollider component and if the component does not exist, it will be instantiated for the Furniture. All MonoBehaviour variables in a Component will use the '''ComponentName''' record set in the other tags, or alternatively you can add a Transforms tag to define empty objects with a Name, Position and Rotation. Using '''self''' as a value for a MonoBehaviour variable will find the corresponding component in the furniture object itself. This allows for anything to be added to a furniture, even MonoBehaviors from custom mods.
+
Other than the elements described so far, all tables added to the root table are interpreted as Unity MonoBehaviour components. If you added a table called '''BoxCollider''', the children records would be interpreted as variables of the BoxCollider component and if the component does not exist, it will be instantiated for the Furniture. All MonoBehaviour variables in a Component will use the '''ComponentName''' record set in the other tags, or alternatively you can add a Transforms list to define empty transforms with a Name, Position and Rotation. Using '''self''' as a value for a MonoBehaviour variable will find the corresponding component in the root furniture object itself. This allows for anything to be added to a furniture, even MonoBehaviors from custom mods.
   −
If you set the '''ParentTransform''' record to a '''ComponentName''' reference, the component will be fetched/added to the object instead. This could be used to add a PointLight component to an empty object to make your own lights. Make sure to add a LampScript component to your furniture object if you’re making a custom lamp, so the game can control shadows and lighting.
+
If you set the '''ParentTransform''' record to a '''ComponentName''' reference, the component will be fetched/added to that object instead of the root furniture object. This could be used to add a Light component to an empty object to make your own lights. Make sure to add a '''LampScript''' component to your furniture object if you’re making a custom lamp, so the game can control shadows and lighting.
   −
Setting a Destroy attribute to “True” for a tag will remove that MonoBehavior from the furniture.
+
Adding a '''RemoveComponent True''' record for a table will remove that MonoBehavior from the furniture or '''TransformParent'''.
   −
Note that using MonoBehaviors from other mods requires setting the Namespace attribute and the Assembly attribute so the game knows where to find the classes, e.g. <MyCustomComponent Namespace=”MyMod.Behaviours.Assembly=”MyMod”>.
+
Note that using MonoBehaviors from other mods requires adding a '''Namespace''' and '''Assembly''' record, so the game knows where to find the classes, e.g.
 +
'''Namespace''' "MyMod.Behaviours."
 +
'''Assembly''' MyMod
    
==== Furniture ====
 
==== Furniture ====

Navigation menu