No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

TMP_Asset.cs 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. using System;
  2. using UnityEngine;
  3. using UnityEngine.Serialization;
  4. using UnityEngine.TextCore;
  5. namespace TMPro
  6. {
  7. // Base class inherited by the various TextMeshPro Assets.
  8. [Serializable]
  9. public abstract class TMP_Asset : ScriptableObject
  10. {
  11. /// <summary>
  12. /// The version of the text asset class.
  13. /// Version 1.1.0 introduces new data structure to be compatible with new font asset structure.
  14. /// </summary>
  15. public string version
  16. {
  17. get { return m_Version; }
  18. internal set { m_Version = value; }
  19. }
  20. /// <summary>
  21. /// Instance ID of the TMP Asset
  22. /// </summary>
  23. public int instanceID
  24. {
  25. get
  26. {
  27. if (m_InstanceID == 0)
  28. m_InstanceID = GetInstanceID();
  29. return m_InstanceID;
  30. }
  31. }
  32. /// <summary>
  33. /// HashCode based on the name of the asset.
  34. /// </summary>
  35. public int hashCode
  36. {
  37. get
  38. {
  39. if (m_HashCode == 0)
  40. m_HashCode = TMP_TextUtilities.GetHashCode(name);
  41. return m_HashCode;
  42. }
  43. set => m_HashCode = value;
  44. }
  45. /// <summary>
  46. /// Information about the face of the asset.
  47. /// </summary>
  48. public FaceInfo faceInfo
  49. {
  50. get { return m_FaceInfo; }
  51. set { m_FaceInfo = value; }
  52. }
  53. /// <summary>
  54. /// The material used by this asset.
  55. /// </summary>
  56. public Material material
  57. {
  58. get => m_Material;
  59. set => m_Material = value;
  60. }
  61. /// <summary>
  62. /// HashCode based on the name of the material assigned to this asset.
  63. /// </summary>
  64. public int materialHashCode
  65. {
  66. get
  67. {
  68. if (m_MaterialHashCode == 0)
  69. {
  70. if (m_Material == null)
  71. return 0;
  72. m_MaterialHashCode = TMP_TextUtilities.GetSimpleHashCode(m_Material.name);
  73. }
  74. return m_MaterialHashCode;
  75. }
  76. set => m_MaterialHashCode = value;
  77. }
  78. // =============================================
  79. // Private backing fields for public properties.
  80. // =============================================
  81. [SerializeField]
  82. internal string m_Version;
  83. internal int m_InstanceID;
  84. internal int m_HashCode;
  85. [SerializeField]
  86. internal FaceInfo m_FaceInfo;
  87. [SerializeField][FormerlySerializedAs("material")]
  88. internal Material m_Material;
  89. internal int m_MaterialHashCode;
  90. }
  91. }