GameObjectUtility.GetUniqueNameForSibling

切换到手册
public static string GetUniqueNameForSibling (Transform parent, string name);

参数

parentGameObject 的目标父级。Null 表示根级。
nameGameObject 的请求名称。

返回

stringGameObject 的唯一名称。

描述

与现有同级对象相比,获得新 GameObject 的唯一名称。对于尝试避免重复命名非常有用。发现重复名称时,在基本名称后使用增量数字。