Version: 2020.3

ObjectNames.NicifyVariableName

매뉴얼로 전환
public static string NicifyVariableName (string name);

설명

Make a displayable name for a variable.

This function will insert spaces before capital letters and remove optional m_, _ or k followed by uppercase letter in front of the name.

using UnityEngine;
using UnityEditor;

public class Example : MonoBehaviour { private void Start() { // prints "My Variable" print(ObjectNames.NicifyVariableName("MyVariable")); // prints "The Other Variable" print(ObjectNames.NicifyVariableName("m_TheOtherVariable")); // prints "Some Constant" print(ObjectNames.NicifyVariableName("kSomeConstant")); } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961