GameObjectUtility.EnsureUniqueNameForSibling

Switch to Manual
public static void EnsureUniqueNameForSibling (GameObject self);

Parameters

selfThe GameObject whose name you want to ensure is unique.

Description

You can use this method after parenting one GameObject to another to ensure the child GameObject has a unique name compared to its siblings in the hierarchy.

If the GameObject already has a unique name compared to its siblings, its name will remain unchanged. If the GameObject has the same name as one of its siblings, Unity will rename it to a unique name by using an incremental number after the GameObject’s current name. This is useful when trying to avoid duplicate naming.

See Also: GameObjectUtility.GetUniqueNameForSibling, ObjectNames.GetUniqueName.

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961