public static void MoveToBottom(this Component current) { if (current.IsNull()) { return; } ProxyEditor.DisconnectPrefabInstance(current); Component[] components = current.GetComponents <Component>(); int position = components.IndexOf(current); current.Move(components.Length - position); }
public static void Move(this Component current, int amount) { if (current.IsNull()) { return; } ProxyEditor.DisconnectPrefabInstance(current); while (amount != 0) { if (amount > 0) { ProxyEditor.MoveComponentDown(current); amount -= 1; } if (amount < 0) { ProxyEditor.MoveComponentUp(current); amount += 1; } } }