mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 14:24:53 +08:00
[unity] Make components compatible with new 2018.3 Prefab Mode.
This commit is contained in:
parent
9e7783e4c2
commit
66689b3800
@ -28,12 +28,21 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#if UNITY_2018_3 || UNITY_2019
|
||||||
|
#define NEW_PREFAB_SYSTEM
|
||||||
|
#endif
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Spine.Unity {
|
namespace Spine.Unity {
|
||||||
|
|
||||||
/// <summary>Sets a GameObject's transform to match a bone on a Spine skeleton.</summary>
|
/// <summary>Sets a GameObject's transform to match a bone on a Spine skeleton.</summary>
|
||||||
|
#if NEW_PREFAB_SYSTEM
|
||||||
|
[ExecuteAlways]
|
||||||
|
#else
|
||||||
[ExecuteInEditMode]
|
[ExecuteInEditMode]
|
||||||
|
#endif
|
||||||
[AddComponentMenu("Spine/BoneFollower")]
|
[AddComponentMenu("Spine/BoneFollower")]
|
||||||
public class BoneFollower : MonoBehaviour {
|
public class BoneFollower : MonoBehaviour {
|
||||||
|
|
||||||
|
|||||||
@ -28,13 +28,19 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
using System.Collections;
|
#if UNITY_2018_3 || UNITY_2019 || UNITY_2018_3_OR_NEWER
|
||||||
using System.Collections.Generic;
|
#define NEW_PREFAB_SYSTEM
|
||||||
|
#endif
|
||||||
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Spine.Unity {
|
namespace Spine.Unity {
|
||||||
|
|
||||||
|
#if NEW_PREFAB_SYSTEM
|
||||||
|
[ExecuteAlways]
|
||||||
|
#else
|
||||||
[ExecuteInEditMode]
|
[ExecuteInEditMode]
|
||||||
|
#endif
|
||||||
[AddComponentMenu("Spine/Point Follower")]
|
[AddComponentMenu("Spine/Point Follower")]
|
||||||
public class PointFollower : MonoBehaviour, IHasSkeletonRenderer, IHasSkeletonComponent {
|
public class PointFollower : MonoBehaviour, IHasSkeletonRenderer, IHasSkeletonComponent {
|
||||||
|
|
||||||
|
|||||||
@ -28,11 +28,19 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#if UNITY_2018_3 || UNITY_2019 || UNITY_2018_3_OR_NEWER
|
||||||
|
#define NEW_PREFAB_SYSTEM
|
||||||
|
#endif
|
||||||
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Spine.Unity {
|
namespace Spine.Unity {
|
||||||
|
|
||||||
|
#if NEW_PREFAB_SYSTEM
|
||||||
|
[ExecuteAlways]
|
||||||
|
#else
|
||||||
[ExecuteInEditMode]
|
[ExecuteInEditMode]
|
||||||
|
#endif
|
||||||
[AddComponentMenu("Spine/SkeletonAnimation")]
|
[AddComponentMenu("Spine/SkeletonAnimation")]
|
||||||
public class SkeletonAnimation : SkeletonRenderer, ISkeletonAnimation, IAnimationStateComponent {
|
public class SkeletonAnimation : SkeletonRenderer, ISkeletonAnimation, IAnimationStateComponent {
|
||||||
|
|
||||||
|
|||||||
@ -28,6 +28,9 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#if UNITY_2018_3 || UNITY_2019 || UNITY_2018_3_OR_NEWER
|
||||||
|
#define NEW_PREFAB_SYSTEM
|
||||||
|
#endif
|
||||||
#define SPINE_OPTIONAL_RENDEROVERRIDE
|
#define SPINE_OPTIONAL_RENDEROVERRIDE
|
||||||
#define SPINE_OPTIONAL_MATERIALOVERRIDE
|
#define SPINE_OPTIONAL_MATERIALOVERRIDE
|
||||||
|
|
||||||
@ -36,7 +39,12 @@ using UnityEngine;
|
|||||||
|
|
||||||
namespace Spine.Unity {
|
namespace Spine.Unity {
|
||||||
/// <summary>Base class of animated Spine skeleton components. This component manages and renders a skeleton.</summary>
|
/// <summary>Base class of animated Spine skeleton components. This component manages and renders a skeleton.</summary>
|
||||||
[ExecuteInEditMode, RequireComponent(typeof(MeshFilter), typeof(MeshRenderer)), DisallowMultipleComponent]
|
#if NEW_PREFAB_SYSTEM
|
||||||
|
[ExecuteAlways]
|
||||||
|
#else
|
||||||
|
[ExecuteInEditMode]
|
||||||
|
#endif
|
||||||
|
[RequireComponent(typeof(MeshFilter), typeof(MeshRenderer)), DisallowMultipleComponent]
|
||||||
[HelpURL("http://esotericsoftware.com/spine-unity-rendering")]
|
[HelpURL("http://esotericsoftware.com/spine-unity-rendering")]
|
||||||
public class SkeletonRenderer : MonoBehaviour, ISkeletonComponent, IHasSkeletonDataAsset {
|
public class SkeletonRenderer : MonoBehaviour, ISkeletonComponent, IHasSkeletonDataAsset {
|
||||||
[SerializeField] public SkeletonDataAsset skeletonDataAsset;
|
[SerializeField] public SkeletonDataAsset skeletonDataAsset;
|
||||||
|
|||||||
@ -27,13 +27,20 @@
|
|||||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
#if UNITY_2018_3 || UNITY_2019 || UNITY_2018_3_OR_NEWER
|
||||||
|
#define NEW_PREFAB_SYSTEM
|
||||||
|
#endif
|
||||||
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Spine.Unity {
|
namespace Spine.Unity {
|
||||||
|
|
||||||
|
#if NEW_PREFAB_SYSTEM
|
||||||
|
[ExecuteAlways]
|
||||||
|
#else
|
||||||
[ExecuteInEditMode]
|
[ExecuteInEditMode]
|
||||||
|
#endif
|
||||||
public class BoundingBoxFollower : MonoBehaviour {
|
public class BoundingBoxFollower : MonoBehaviour {
|
||||||
internal static bool DebugMessages = true;
|
internal static bool DebugMessages = true;
|
||||||
|
|
||||||
|
|||||||
@ -28,6 +28,9 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#if UNITY_2018_3 || UNITY_2019 || UNITY_2018_3_OR_NEWER
|
||||||
|
#define NEW_PREFAB_SYSTEM
|
||||||
|
#endif
|
||||||
#define SPINE_OPTIONAL_MATERIALOVERRIDE
|
#define SPINE_OPTIONAL_MATERIALOVERRIDE
|
||||||
|
|
||||||
// Contributed by: Lost Polygon
|
// Contributed by: Lost Polygon
|
||||||
@ -37,7 +40,11 @@ using System.Collections.Generic;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Spine.Unity.Modules {
|
namespace Spine.Unity.Modules {
|
||||||
|
#if NEW_PREFAB_SYSTEM
|
||||||
|
[ExecuteAlways]
|
||||||
|
#else
|
||||||
[ExecuteInEditMode]
|
[ExecuteInEditMode]
|
||||||
|
#endif
|
||||||
public class SkeletonRendererCustomMaterials : MonoBehaviour {
|
public class SkeletonRendererCustomMaterials : MonoBehaviour {
|
||||||
|
|
||||||
#region Inspector
|
#region Inspector
|
||||||
|
|||||||
@ -1,9 +1,17 @@
|
|||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
#if UNITY_2018_3 || UNITY_2019 || UNITY_2018_3_OR_NEWER
|
||||||
|
#define NEW_PREFAB_SYSTEM
|
||||||
|
#endif
|
||||||
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Spine.Unity {
|
namespace Spine.Unity {
|
||||||
|
|
||||||
|
#if NEW_PREFAB_SYSTEM
|
||||||
|
[ExecuteAlways]
|
||||||
|
#else
|
||||||
[ExecuteInEditMode]
|
[ExecuteInEditMode]
|
||||||
|
#endif
|
||||||
[DisallowMultipleComponent]
|
[DisallowMultipleComponent]
|
||||||
[AddComponentMenu("Spine/UI/BoneFollowerGraphic")]
|
[AddComponentMenu("Spine/UI/BoneFollowerGraphic")]
|
||||||
public class BoneFollowerGraphic : MonoBehaviour {
|
public class BoneFollowerGraphic : MonoBehaviour {
|
||||||
|
|||||||
@ -28,12 +28,20 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#if UNITY_2018_3 || UNITY_2019 || UNITY_2018_3_OR_NEWER
|
||||||
|
#define NEW_PREFAB_SYSTEM
|
||||||
|
#endif
|
||||||
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using Spine;
|
|
||||||
|
|
||||||
namespace Spine.Unity {
|
namespace Spine.Unity {
|
||||||
[ExecuteInEditMode, RequireComponent(typeof(CanvasRenderer), typeof(RectTransform)), DisallowMultipleComponent]
|
#if NEW_PREFAB_SYSTEM
|
||||||
|
[ExecuteAlways]
|
||||||
|
#else
|
||||||
|
[ExecuteInEditMode]
|
||||||
|
#endif
|
||||||
|
[RequireComponent(typeof(CanvasRenderer), typeof(RectTransform)), DisallowMultipleComponent]
|
||||||
[AddComponentMenu("Spine/SkeletonGraphic (Unity UI Canvas)")]
|
[AddComponentMenu("Spine/SkeletonGraphic (Unity UI Canvas)")]
|
||||||
public class SkeletonGraphic : MaskableGraphic, ISkeletonComponent, IAnimationStateComponent, ISkeletonAnimation, IHasSkeletonDataAsset {
|
public class SkeletonGraphic : MaskableGraphic, ISkeletonComponent, IAnimationStateComponent, ISkeletonAnimation, IHasSkeletonDataAsset {
|
||||||
|
|
||||||
|
|||||||
@ -28,15 +28,21 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#if UNITY_2018_3 || UNITY_2019 || UNITY_2018_3_OR_NEWER
|
||||||
|
#define NEW_PREFAB_SYSTEM
|
||||||
|
#endif
|
||||||
#define SPINE_OPTIONAL_RENDEROVERRIDE
|
#define SPINE_OPTIONAL_RENDEROVERRIDE
|
||||||
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Spine.Unity;
|
|
||||||
|
|
||||||
namespace Spine.Unity.Modules {
|
namespace Spine.Unity.Modules {
|
||||||
|
|
||||||
|
#if NEW_PREFAB_SYSTEM
|
||||||
|
[ExecuteAlways]
|
||||||
|
#else
|
||||||
[ExecuteInEditMode]
|
[ExecuteInEditMode]
|
||||||
|
#endif
|
||||||
[HelpURL("http://esotericsoftware.com/spine-unity-skeletonrenderseparator")]
|
[HelpURL("http://esotericsoftware.com/spine-unity-skeletonrenderseparator")]
|
||||||
public class SkeletonRenderSeparator : MonoBehaviour {
|
public class SkeletonRenderSeparator : MonoBehaviour {
|
||||||
public const int DefaultSortingOrderIncrement = 5;
|
public const int DefaultSortingOrderIncrement = 5;
|
||||||
|
|||||||
@ -28,10 +28,20 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#if UNITY_2018_3 || UNITY_2019 || UNITY_2018_3_OR_NEWER
|
||||||
|
#define NEW_PREFAB_SYSTEM
|
||||||
|
#endif
|
||||||
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Spine.Unity.Modules {
|
namespace Spine.Unity.Modules {
|
||||||
[RequireComponent(typeof(SkeletonUtilityBone)), ExecuteInEditMode]
|
|
||||||
|
#if NEW_PREFAB_SYSTEM
|
||||||
|
[ExecuteAlways]
|
||||||
|
#else
|
||||||
|
[ExecuteInEditMode]
|
||||||
|
#endif
|
||||||
|
[RequireComponent(typeof(SkeletonUtilityBone))]
|
||||||
public class SkeletonUtilityGroundConstraint : SkeletonUtilityConstraint {
|
public class SkeletonUtilityGroundConstraint : SkeletonUtilityConstraint {
|
||||||
|
|
||||||
[Tooltip("LayerMask for what objects to raycast against")]
|
[Tooltip("LayerMask for what objects to raycast against")]
|
||||||
|
|||||||
@ -28,15 +28,21 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
// Contributed by: Mitch Thompson
|
#if UNITY_2018_3 || UNITY_2019 || UNITY_2018_3_OR_NEWER
|
||||||
|
#define NEW_PREFAB_SYSTEM
|
||||||
|
#endif
|
||||||
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Spine;
|
|
||||||
|
|
||||||
namespace Spine.Unity {
|
namespace Spine.Unity {
|
||||||
[RequireComponent(typeof(ISkeletonAnimation))]
|
|
||||||
|
#if NEW_PREFAB_SYSTEM
|
||||||
|
[ExecuteAlways]
|
||||||
|
#else
|
||||||
[ExecuteInEditMode]
|
[ExecuteInEditMode]
|
||||||
|
#endif
|
||||||
|
[RequireComponent(typeof(ISkeletonAnimation))]
|
||||||
public sealed class SkeletonUtility : MonoBehaviour {
|
public sealed class SkeletonUtility : MonoBehaviour {
|
||||||
|
|
||||||
#region BoundingBoxAttachment
|
#region BoundingBoxAttachment
|
||||||
|
|||||||
@ -28,12 +28,19 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#if UNITY_2018_3 || UNITY_2019 || UNITY_2018_3_OR_NEWER
|
||||||
|
#define NEW_PREFAB_SYSTEM
|
||||||
|
#endif
|
||||||
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Spine;
|
|
||||||
|
|
||||||
namespace Spine.Unity {
|
namespace Spine.Unity {
|
||||||
/// <summary>Sets a GameObject's transform to match a bone on a Spine skeleton.</summary>
|
/// <summary>Sets a GameObject's transform to match a bone on a Spine skeleton.</summary>
|
||||||
|
#if NEW_PREFAB_SYSTEM
|
||||||
|
[ExecuteAlways]
|
||||||
|
#else
|
||||||
[ExecuteInEditMode]
|
[ExecuteInEditMode]
|
||||||
|
#endif
|
||||||
[AddComponentMenu("Spine/SkeletonGameObjectsBone")]
|
[AddComponentMenu("Spine/SkeletonGameObjectsBone")]
|
||||||
public class SkeletonUtilityBone : MonoBehaviour {
|
public class SkeletonUtilityBone : MonoBehaviour {
|
||||||
public enum Mode {
|
public enum Mode {
|
||||||
|
|||||||
@ -28,10 +28,20 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#if UNITY_2018_3 || UNITY_2019 || UNITY_2018_3_OR_NEWER
|
||||||
|
#define NEW_PREFAB_SYSTEM
|
||||||
|
#endif
|
||||||
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Spine.Unity {
|
namespace Spine.Unity {
|
||||||
[RequireComponent(typeof(SkeletonUtilityBone)), ExecuteInEditMode]
|
|
||||||
|
#if NEW_PREFAB_SYSTEM
|
||||||
|
[ExecuteAlways]
|
||||||
|
#else
|
||||||
|
[ExecuteInEditMode]
|
||||||
|
#endif
|
||||||
|
[RequireComponent(typeof(SkeletonUtilityBone))]
|
||||||
public abstract class SkeletonUtilityConstraint : MonoBehaviour {
|
public abstract class SkeletonUtilityConstraint : MonoBehaviour {
|
||||||
|
|
||||||
protected SkeletonUtilityBone bone;
|
protected SkeletonUtilityBone bone;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user