UnityEditor.Effector2DEditor.CheckEffectorWarnings C# (CSharp) Method

CheckEffectorWarnings() public static method

public static CheckEffectorWarnings ( Collider2D collider ) : void
collider UnityEngine.Collider2D
return void
        public static void CheckEffectorWarnings(Collider2D collider)
        {
            if (collider.usedByEffector)
            {
                Effector2D component = collider.GetComponent<Effector2D>();
                if ((component == null) || !component.enabled)
                {
                    EditorGUILayout.HelpBox("This collider will not function with an effector until there is at least one enabled 2D effector on this GameObject.", MessageType.Warning);
                    if (component == null)
                    {
                        return;
                    }
                }
                if (component.designedForNonTrigger && collider.isTrigger)
                {
                    EditorGUILayout.HelpBox("This collider has 'Is Trigger' checked but this should be unchecked when used with the '" + component.GetType().Name + "' component which is designed to work with collisions.", MessageType.Warning);
                }
                else if (component.designedForTrigger && !collider.isTrigger)
                {
                    EditorGUILayout.HelpBox("This collider has 'Is Trigger' unchecked but this should be checked when used with the '" + component.GetType().Name + "' component which is designed to work with triggers.", MessageType.Warning);
                }
            }
        }

Usage Example

示例#1
0
 public void FinalizeInspectorGUI()
 {
     this.ShowColliderInfoProperties();
     this.CheckColliderErrorState();
     if (base.targets.Length == 1)
     {
         Collider2D collider2D = base.target as Collider2D;
         if (collider2D.isActiveAndEnabled && collider2D.composite == null && this.m_UsedByComposite.boolValue)
         {
             EditorGUILayout.HelpBox("This collider will not function with a composite until there is a CompositeCollider2D on the GameObject that the attached Rigidbody2D is on.", MessageType.Warning);
         }
     }
     Effector2DEditor.CheckEffectorWarnings(base.target as Collider2D);
 }
All Usage Examples Of UnityEditor.Effector2DEditor::CheckEffectorWarnings