新建自己的脚本
引入这些
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using System.Collections.Generic;
using System.Text.RegularExpressions;
并且保证自己的 脚本继承 自 Text类
内容:
public class 自己的类 : Text
{
///
/// 用于匹配标点符号(正则表达式)
///
//private readonly string strRegex = @"\p{P}"; //启用这个将过滤所有标点,下面的可以选自需要避免的标点
private readonly string strRegex = @"(\!|\?|\,|\。|\)|\:|\“|\‘|\、|\;|\+|\-)";
///
/// /// 用于存储text组件中的内容
/// ///
private System.Text.StringBuilder MExplainText = null;
/// ///
/// /// 用于存储text生成器中的内容
/// ///
private IList MExpalinTextLine;
protected override void OnPopulateMesh(VertexHelper toFill)
{
base.OnPopu