mirror of
https://github.com/BlackMATov/unity-iso-tools.git
synced 2025-12-12 22:26:18 +07:00
fix 2017
This commit is contained in:
@@ -32,13 +32,9 @@ namespace IsoTools.Internal {
|
||||
}
|
||||
|
||||
public static bool DoFoldoutHeaderGroup(bool foldout, string header, System.Action act) {
|
||||
foldout = EditorGUILayout.BeginFoldoutHeaderGroup(foldout, header);
|
||||
try {
|
||||
if ( foldout ) {
|
||||
act();
|
||||
}
|
||||
} finally {
|
||||
EditorGUILayout.EndFoldoutHeaderGroup();
|
||||
foldout = EditorGUILayout.Foldout(foldout, header);
|
||||
if ( foldout ) {
|
||||
act();
|
||||
}
|
||||
return foldout;
|
||||
}
|
||||
@@ -74,6 +70,14 @@ namespace IsoTools.Internal {
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsPrefabInstance(GameObject go) {
|
||||
#if UNITY_2018_3_OR_NEWER
|
||||
return PrefabUtility.IsPartOfAnyPrefab(go);
|
||||
#else
|
||||
return PrefabUtility.GetPrefabType(go) != PrefabType.None;
|
||||
#endif
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
//
|
||||
// Editor
|
||||
@@ -145,7 +149,7 @@ namespace IsoTools.Internal {
|
||||
var result_p_z = iso_orig_z + delta;
|
||||
if ( move ) {
|
||||
iso_object.positionZ = IsoUtils.FloatBeautifier(result_p_z);
|
||||
if ( PrefabUtility.GetPrefabInstanceStatus(iso_object) != PrefabInstanceStatus.NotAPrefab ) {
|
||||
if ( IsoEditorUtils.IsPrefabInstance(iso_object.gameObject) ) {
|
||||
PrefabUtility.RecordPrefabInstancePropertyModifications(iso_object);
|
||||
}
|
||||
}
|
||||
@@ -249,7 +253,7 @@ namespace IsoTools.Internal {
|
||||
var result_pos_iso = iso_orig_p + iso_delta;
|
||||
if ( move ) {
|
||||
iso_object.position = IsoUtils.VectorBeautifier(result_pos_iso);
|
||||
if ( PrefabUtility.GetPrefabInstanceStatus(iso_object) != PrefabInstanceStatus.NotAPrefab ) {
|
||||
if ( IsoEditorUtils.IsPrefabInstance(iso_object.gameObject) ) {
|
||||
PrefabUtility.RecordPrefabInstancePropertyModifications(iso_object);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ namespace IsoTools.Internal {
|
||||
foreach ( var iso_object in _isoObjects[iso_world] ) {
|
||||
iso_object.FixIsoPosition();
|
||||
iso_object.positionXY = IsoUtils.VectorBeautifier(iso_object.positionXY);
|
||||
if ( PrefabUtility.GetPrefabInstanceStatus(iso_object) != PrefabInstanceStatus.NotAPrefab ) {
|
||||
if ( IsoEditorUtils.IsPrefabInstance(iso_object.gameObject) ) {
|
||||
PrefabUtility.RecordPrefabInstancePropertyModifications(iso_object);
|
||||
}
|
||||
}
|
||||
@@ -137,7 +137,7 @@ namespace IsoTools.Internal {
|
||||
foreach ( var iso_object in _isoObjects[iso_world] ) {
|
||||
iso_object.FixIsoPosition();
|
||||
iso_object.positionXY = IsoUtils.VectorBeautifier(iso_object.positionXY);
|
||||
if ( PrefabUtility.GetPrefabInstanceStatus(iso_object) != PrefabInstanceStatus.NotAPrefab ) {
|
||||
if ( IsoEditorUtils.IsPrefabInstance(iso_object.gameObject) ) {
|
||||
PrefabUtility.RecordPrefabInstancePropertyModifications(iso_object);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user