Skip to content

adampassey/Contained

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contained

Unity3D components and delegates for detecting whether a Collider2D is fully contained within another Collider2D.

Installation

Download the contained.unitypackage and import it into Unity by going to Assets > Import Package > Custom Package. Choose contained.unitypackage and import all assets.

Setup

Contained notifies components of horizontal containment only. In order to listen to these events, attach a HorizontallyContained component to your GameObject as well as the component that will be listening to these events. You can then subscribe to these events by implementing the IHorizontallyContainedDelegate from within the Contained namespace. An example of this can be seen below:

using UnityEngine;
using Contained;

namespace Example {

    public class ContainedListener : MonoBehaviour, IHorizontallyContained2DDelegate {

        public void OnHorizontalContain(Collider2D other) {
            Debug.Log("Listener notified of containment!");
        }

        public void OnHorizontalExit(Collider2D other) {
            Debug.Log("Listener notified of exit!");
        }
    }
}

About

Delegates and messages for Collider2D containment in Unity3d.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages