Hi!
I wonder if it’s possible to have a prefab/gameobject to trigger when another object is dropped on it. Like in this image:
I have all these placeholder where to drop other objects. I need to be able to receive the dropped object and put it in a local property (lifeLine). Would that be possible?
This is just my test code so far:
using UnityEngine;
using System.Collections;
public class LifelinePlaceholder : MonoBehaviour {
public GameObject lifeLine;
public string Name;
// Use this for initialization
void Start () {
Debug.Log ("Yeah!");
}
// Update is called once per frame
void Update () {
}
void OnMouseUp()
{
Debug.Log (Name);
//Debug.Log ("foobar");
}
void OnTriggerEnter2D(Collider2D other) {
Debug.Log(other.gameObject);
}
void OnCollisionEnter2D(Collision2D other){
Debug.Log(other.gameObject);
}
}
Thanks in advance!