mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-10 17:18:44 +08:00
[unity] Fixed exception when new Unity 2019.3 Enter Play Mode has disabled domain reload. Closes #1621.
This commit is contained in:
parent
8a444681d2
commit
84443288b5
@ -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);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user