[unity] Fixed exception when new Unity 2019.3 Enter Play Mode has disabled domain reload. Closes #1621.

This commit is contained in:
Harald Csaszar 2020-07-10 18:37:36 +02:00
parent 8a444681d2
commit 84443288b5

View File

@ -27,10 +27,16 @@
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
#if UNITY_2019_3_OR_NEWER
#define CONFIGURABLE_ENTER_PLAY_MODE
#endif
using UnityEngine;
using System.Collections.Generic;
using System;
namespace Spine.Unity.AttachmentTools {
public static class AtlasUtilities {
@ -41,6 +47,14 @@ namespace Spine.Unity.AttachmentTools {
const int NonrenderingRegion = -1;
#if CONFIGURABLE_ENTER_PLAY_MODE
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
static void Init () {
// handle disabled domain reload
AtlasUtilities.ClearCache();
}
#endif
public static AtlasRegion ToAtlasRegion (this Texture2D t, Material materialPropertySource, float scale = DefaultScale) {
return t.ToAtlasRegion(materialPropertySource.shader, scale, materialPropertySource);
}