UnityTextureData.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. using UnityEngine;
  2. namespace DragonBones
  3. {
  4. /**
  5. * @language zh_CN
  6. * Unity 贴图集数据。
  7. * @version DragonBones 3.0
  8. */
  9. public class UnityTextureAtlasData : TextureAtlasData
  10. {
  11. /**
  12. * @private
  13. */
  14. internal bool _disposeTexture;
  15. /**
  16. * @language zh_CN
  17. * Unity 贴图。
  18. * @version DragonBones 3.0
  19. */
  20. public Material texture;
  21. /**
  22. * @private
  23. */
  24. public UnityTextureAtlasData()
  25. {
  26. }
  27. /**
  28. * @private
  29. */
  30. override protected void _onClear()
  31. {
  32. base._onClear();
  33. if (_disposeTexture && texture != null)
  34. {
  35. #if UNITY_EDITOR
  36. //Object.DestroyImmediate(texture);
  37. #else
  38. Object.Destroy(texture);
  39. #endif
  40. }
  41. _disposeTexture = false;
  42. texture = null;
  43. }
  44. /**
  45. * @private
  46. */
  47. override public TextureData GenerateTextureData()
  48. {
  49. return BaseObject.BorrowObject<UnityTextureData>();
  50. }
  51. }
  52. /**
  53. * @private
  54. */
  55. public class UnityTextureData : TextureData
  56. {
  57. public UnityTextureData()
  58. {
  59. }
  60. }
  61. }