Created
November 28, 2016 10:58
-
-
Save peroon/d41b2be2a091da9eb4aa68ae9820fb78 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using UnityEngine; | |
| using UnityEditor; | |
| using UnityEngine.UI; | |
| using System.Collections; | |
| using DL; | |
| // Textで作っちゃってDLTextに移行するのが面倒なときに使う | |
| public class TextToDLText { | |
| [MenuItem("Tools/k-ishibashi/TextToDLText")] | |
| static void Swap(){ | |
| foreach (var go in Selection.gameObjects) { | |
| var textComponent = go.GetComponent<Text> (); | |
| Debug.Log (textComponent.text); | |
| GameObject.DestroyImmediate (go.GetComponent<Text> ()); | |
| var dlText = go.AddComponent<Imas.DLText> (); | |
| // コピー | |
| dlText.font = textComponent.font; // フォント | |
| dlText.fontSize = textComponent.fontSize; // フォントサイズ | |
| dlText.color = textComponent.color; // 色 | |
| dlText.alignment = textComponent.alignment; // センタリング | |
| dlText.lineSpacing = textComponent.lineSpacing; // スペース | |
| // テキストキー | |
| dlText.TextKey = textComponent.text; | |
| dlText.SetText(textComponent.text); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment