@@ -13,6 +13,9 @@ public sealed class LDtkComponentEntity : MonoBehaviour
1313 [ field: Tooltip ( "This entity's layer" ) ]
1414 [ field: SerializeField ] public LDtkComponentLayer Parent { get ; private set ; }
1515
16+ [ field: Tooltip ( "This entity's size in unity units" ) ]
17+ [ field: SerializeField ] public Vector2 Size { get ; private set ; }
18+
1619 [ field: Header ( "Redundant Fields" ) ]
1720 [ field: Tooltip ( "Grid-based coordinates" ) ]
1821 [ field: SerializeField ] public Vector2Int Grid { get ; private set ; }
@@ -43,15 +46,15 @@ public sealed class LDtkComponentEntity : MonoBehaviour
4346 [ field: SerializeField ] public LDtkFields FieldInstances { get ; private set ; }
4447
4548 [ field: Tooltip ( "Entity size in pixels. For non-resizable entities, it will be the same as Entity definition." ) ]
46- [ field: SerializeField ] public Vector2Int Size { get ; private set ; }
49+ [ field: SerializeField ] public Vector2Int PxSize { get ; private set ; }
4750
4851 [ field: Tooltip ( "Unique instance identifier" ) ]
4952 [ field: SerializeField ] public LDtkIid Iid { get ; private set ; }
5053
5154 [ field: Tooltip ( "Pixel coordinates in current level coordinate space. Don't forget optional layer offsets, if they exist!" ) ]
5255 [ field: SerializeField ] public Vector2Int Px { get ; private set ; }
5356
54- internal void OnImport ( LDtkDefinitionObjectsCache cache , EntityInstance entity , LDtkComponentLayer layer , LDtkFields fields , LDtkIid iid )
57+ internal void OnImport ( LDtkDefinitionObjectsCache cache , EntityInstance entity , LDtkComponentLayer layer , LDtkFields fields , LDtkIid iid , Vector2 size )
5558 {
5659 Grid = entity . UnityGrid ;
5760 Identifier = entity . Identifier ;
@@ -62,12 +65,13 @@ internal void OnImport(LDtkDefinitionObjectsCache cache, EntityInstance entity,
6265 WorldCoord = entity . UnityWorld ;
6366 Def = cache . GetObject < LDtkDefinitionObjectEntity > ( entity . DefUid ) ;
6467 FieldInstances = fields ;
65- Size = entity . UnitySize ;
68+ PxSize = entity . UnityPxSize ;
6669 Iid = iid ;
6770 Px = entity . UnityPx ;
6871
6972 //custom
7073 Parent = layer ;
74+ Size = size ;
7175 }
7276 }
7377}
0 commit comments