Skip to content

Instantly share code, notes, and snippets.

@mogeta
Created January 10, 2013 02:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mogeta/4498993 to your computer and use it in GitHub Desktop.
Save mogeta/4498993 to your computer and use it in GitHub Desktop.
DeleteObject under DELETE_Y_POS
using UnityEngine;
using System.Collections;
public class CheckFallDelete : MonoBehaviour
{
GameObject manager;
private const float sendParameter = 1;
private const float DELETE_Y_POS = -3;
// Use this for initialization
void Start ()
{
manager = GameObject.Find("Manager");
}
// Update is called once per frame
void Update ()
{
if (transform.position.y < DELETE_Y_POS)
{
manager.SendMessage("receiveFallObject",sendParameter);
//Destroy(this); //only delete component
Destroy(this.gameObject);
}
}
}
using UnityEngine;
using System.Collections;
public class GameManager : MonoBehaviour
{
// Use this for initialization
void Start ()
{
}
void receiveFallObject(float param)
{
Debug.Log(param);
}
// Update is called once per frame
void Update ()
{
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment