|
|
|
|
|
|
/// <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; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|