Sprite Factory

ReadMe
Release Notes
Overview
Using the Editor
Upgrading

Concepts
Sprites
Master Sprites
Sprite Groups
Colliders
Locators
Material Sets
SpriteUpdater
SpriteCamera

Advanced
Working in Multiple Projects

Classes
Runtime Classes

Videos
Overview
Creating Sprites
Sprite Inspector
Frame Events
Collision System
Locator System
Material Sets

Links
Sprite Factory Site
Web Documentation
Support
Contact

SpriteFactory.SpriteCollider.OnMouseExitSprite

C#: void OnMouseExitSprite (SpriteFactory.SpriteCollider.CollisionData collisionData)
JS: function OnMouseExitSprite (collisionData : SpriteFactory.SpriteCollider.CollisionData) : void

Description
Called when the mouse is not any longer over the Collider. OnMouseExit balances out OnMouseEnter. This message is sent to all component siblings of the Sprite which owns this SpriteCollider.

The collisionData object contains information about the collision. collisionData.spriteColliderId and collisionData.spriteColliderName can be used to determine which collider the mouse is interacting with.

This function is not called on objects that belong to Ignore Raycast layer.

NOTE: SpriteColliders set to Parent in the Sprite Factory editor do not send this message. For Parent colliders (generated colliders that exist on the same GameObject as the main Sprite component), use the standard Unity OnMouseExit instead.

IMPORTANT: This message is not sent on mobile platforms.

Example:

C#

// Attach this script to the GameObject that contains your main Sprite component
using UnityEngine;
using System.Collections;
using SpriteFactory;

public class MouseExit : MonoBehaviour {
   void OnMouseExitSprite(SpriteFactory.SpriteCollider.CollisionData collisionData) {
       if(collisionData.spriteColliderName == "MouseCollider") { // test collider name to determine which responded
           Debug.Log(collisionData.spriteColliderName + " was exited by mouse!");
       }
   }
}

JS:

// Attach this script to the GameObject that contains your main Sprite component
import SpriteFactory;

function OnMouseExitSprite(collisionData : SpriteFactory.SpriteCollider.CollisionData) : void {
    if(collisionData.spriteColliderName == "MouseCollider") { // test collider name to determine which responded
        Debug.Log(collisionData.spriteColliderName + " was exited by mouse!");
    }
}