浏览代码

ReplaceTool selection and sibling index fix (#277)

* Change Selection to newly created instances

* Keep correct sibling index on replace
/devlogs-3-input
GitHub 4 年前
当前提交
3977c081
共有 1 个文件被更改,包括 11 次插入3 次删除
  1. 14
      UOP1_Project/Assets/Scripts/Editor/ReplaceTool.cs

14
UOP1_Project/Assets/Scripts/Editor/ReplaceTool.cs


/// <param name="replaceObject">Prefab that will be instantiated in place of the objects to replace.</param>
internal static void ReplaceSelectedObjects(GameObject[] objectToReplace, GameObject replaceObject)
{
//Debug.Log("[Replace Tool] Replace process");
var newInstances = new int[objectToReplace.Length];
var sibling = go.transform.GetSiblingIndex();
newInstances[i] = inst.GetInstanceID();
inst.transform.SetSiblingIndex(sibling);
Undo.RegisterCreatedObjectUndo(inst, "Replacement creation.");
foreach (Transform child in go.transform)
{

}
//Debug.LogFormat("[Replace Tool] {0} objects replaced on scene with {1}", objectToReplace.Length, replaceObject.name);
Selection.instanceIDs = newInstances;
}
}

正在加载...
取消
保存