From 5532ca290df7b3cf11836908c899ad6f7bc1acc2 Mon Sep 17 00:00:00 2001 From: Alexander Brazie Date: Thu, 21 Jul 2016 16:24:20 +0200 Subject: [PATCH] [Unity] Added BoundingBoxFollower.isTrigger (#635) * Added isTrigger variable to bounding box followers IsTrigger added to bounding box follower. * Added isTrigger variable to bounding box followers Same as the last one. --- .../Modules/BoundingBoxFollower/BoundingBoxFollower.cs | 3 +++ .../Editor/BoundingBoxFollowerInspector.cs | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/spine-unity/Assets/spine-unity/Modules/BoundingBoxFollower/BoundingBoxFollower.cs b/spine-unity/Assets/spine-unity/Modules/BoundingBoxFollower/BoundingBoxFollower.cs index 27933c34d..f6ef88814 100644 --- a/spine-unity/Assets/spine-unity/Modules/BoundingBoxFollower/BoundingBoxFollower.cs +++ b/spine-unity/Assets/spine-unity/Modules/BoundingBoxFollower/BoundingBoxFollower.cs @@ -39,6 +39,7 @@ namespace Spine.Unity { public SkeletonRenderer skeletonRenderer; [SpineSlot(dataField: "skeletonRenderer", containsBoundingBoxes: true)] public string slotName; + public bool isTrigger; #endregion Slot slot; @@ -56,6 +57,7 @@ namespace Spine.Unity { public BoundingBoxAttachment CurrentAttachment { get { return currentAttachment; } } public string CurrentAttachmentName { get { return currentAttachmentName; } } public PolygonCollider2D CurrentCollider { get { return currentCollider; } } + public bool IsTrigger { get { return isTrigger; } } void OnEnable () { ClearColliders(); @@ -117,6 +119,7 @@ namespace Spine.Unity { var bbCollider = SkeletonUtility.AddBoundingBoxAsComponent(boundingBoxAttachment, gameObject, true); bbCollider.enabled = false; bbCollider.hideFlags = HideFlags.NotEditable; + bbCollider.isTrigger = IsTrigger; colliderTable.Add(boundingBoxAttachment, bbCollider); attachmentNameTable.Add(boundingBoxAttachment, attachmentName); } diff --git a/spine-unity/Assets/spine-unity/Modules/BoundingBoxFollower/Editor/BoundingBoxFollowerInspector.cs b/spine-unity/Assets/spine-unity/Modules/BoundingBoxFollower/Editor/BoundingBoxFollowerInspector.cs index f4f758802..2968a7c60 100644 --- a/spine-unity/Assets/spine-unity/Modules/BoundingBoxFollower/Editor/BoundingBoxFollowerInspector.cs +++ b/spine-unity/Assets/spine-unity/Modules/BoundingBoxFollower/Editor/BoundingBoxFollowerInspector.cs @@ -36,7 +36,7 @@ namespace Spine.Unity.Editor { [CustomEditor(typeof(BoundingBoxFollower))] public class BoundingBoxFollowerInspector : UnityEditor.Editor { - SerializedProperty skeletonRenderer, slotName; + SerializedProperty skeletonRenderer, slotName, isTrigger; BoundingBoxFollower follower; bool rebuildRequired = false; bool addBoneFollower = false; @@ -44,6 +44,7 @@ namespace Spine.Unity.Editor { void OnEnable () { skeletonRenderer = serializedObject.FindProperty("skeletonRenderer"); slotName = serializedObject.FindProperty("slotName"); + isTrigger = serializedObject.FindProperty("isTrigger"); follower = (BoundingBoxFollower)target; } @@ -59,6 +60,8 @@ namespace Spine.Unity.Editor { EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(skeletonRenderer); EditorGUILayout.PropertyField(slotName, new GUIContent("Slot")); + EditorGUILayout.PropertyField(isTrigger, new GUIContent ("IsTrigger")); + if (EditorGUI.EndChangeCheck()) { serializedObject.ApplyModifiedProperties(); if (!isInspectingPrefab)