Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sassembla/dd9a5de1826aa190ff583164fe9c537c to your computer and use it in GitHub Desktop.
Save sassembla/dd9a5de1826aa190ff583164fe9c537c to your computer and use it in GitHub Desktop.
// Text textComponent みたいなものに対して
// TextGenerator generator = new TextGenerator(); みたいなのをグローバルで取得しておいて使い回すことができる
// invalidate first.
generator.Invalidate();
// set content to prefab.
var defaultText = textComponent.text;
textComponent.text = text;
var setting = textComponent.GetGenerationSettings(new Vector2(viewWidth, float.PositiveInfinity));
generator.Populate(text, setting);
var lineCount = generator.lineCount;
var lines = generator.lines;// 各行の情報、行の高さとかspacingの高さが取れる
@sassembla
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment