static void CreateTextMeshProObjectPerform(MenuCommand command) { GameObject go = new GameObject("Text (RubyTMP)"); // Add support for new prefab mode StageUtility.PlaceGameObjectInCurrentStage(go); RubyTextMeshPro textMeshPro = go.AddComponent <RubyTextMeshPro>(); textMeshPro.text = textMeshPro.UnditedText = "Sample text"; textMeshPro.alignment = TextAlignmentOptions.TopLeft; Undo.RegisterCreatedObjectUndo((Object)go, "Create " + go.name); GameObject contextObject = command.context as GameObject; if (contextObject != null) { GameObjectUtility.SetParentAndAlign(go, contextObject); Undo.SetTransformParent(go.transform, contextObject.transform, "Parent " + go.name); } Selection.activeGameObject = go; }
// Start is called before the first frame update void Start() { rubyTextMeshPro = GetComponent <RubyTextMeshPro>(); StartCoroutine(TimeUpdate()); }