Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,15 @@ private void DoPrefabReplacements()
{
objectsById[so.m_Id].BroadcastProperty(p, objectsById);
}

if (so.gameObject.GetSuperPropertyValueBool(StringConstants.Unity_PrefabKeepObject, false))
{
var superObjectCopy = objectsById[so.m_Id].AddComponent<SuperObject>();
EditorUtility.CopySerialized(so, superObjectCopy);

var superPropsCopy = objectsById[so.m_Id].AddComponent<SuperCustomProperties>();
EditorUtility.CopySerialized(props, superPropsCopy);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ public static class StringConstants
public const string Unity_Ignore = Unity_Prefix + "ignore";
public const string Unity_IsTrigger = Unity_Prefix + "IsTrigger";
public const string Unity_Layer = Unity_Prefix + "layer";
public const string Unity_PrefabKeepObject = Unity_Prefix + "prefabKeepObject";
public const string Unity_SortingLayer = Unity_Prefix + "SortingLayer";
public const string Unity_SortingLayerName = Unity_Prefix + "SortingLayerName";
public const string Unity_SortingOrder = Unity_Prefix + "SortingOrder";
Expand Down
1 change: 1 addition & 0 deletions docs/manual/custom-properties-importing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ These custom properties always have a :code:`unity:` prefix so that they do not
* **Collision**: The colliders are not imported for the layer."
":code:`unity:IsTrigger`", ":code:`bool`", "Layers, Tileset, Tile, Collider, Collider Group", "Controls the :code:`isTrigger` setting of the :code:`Collider2D` object generated in the prefab. Add as a layer custom property to override all colliders for a given layer."
":code:`unity:layer`", ":code:`string`", "Layers, Tileset, Tile, Collider, Collider Group", "Controls which Unity phyisics layer our generated colliders are assigned. The layer name must exist in your project's Tag Manager."
":code:`unity:prefabKeepObject`", ":code:`bool`", "Objects", "When set on a prefab replacement object, will retain the SuperObject and SuperCustomProperties."
":code:`unity:SortingLayer`", ":code:`string`", "Layers, Tile Objects", "Controls which sorting layer is assigned to the Unity :code:`Renderer` component created for your tilemaps and sprites. The sorting layer name must exist in your project's Tag Manager."
":code:`unity:SortingOrder`", ":code:`int`", "Layers, Tile Objects", "Controls which sorting order is applied to the Unity :code:`Renderer` component created for your tilemaps and sprites."
":code:`unity:Tag`", ":code:`string`", "Layers, Objects", "Controls which tag is applied to the :code:`GameObject` created for your layers and objects. The tag must exist in your project's Tag Manager."
Expand Down