Hello, I am working on a card game for the web. I have four prefabs for the backs of the cards: blue, red, yellow, green. Right now I can push play and the script instantiates a blue card, but I can't figure out how to register a click on this card.
Attached to the main camera, instantiate_prefabs.js:
var blue_card : GameObject;
function Start () {
var blue_card = Instantiate(blue_card,
Vector3 (0, 0, 0), Quaternion.identity);
}
Attached to each of the four prefabs for blue_card, red_card, yellow_card, green_card, flip_card.js:
function OnMouseDown() {
Debug.Log("Prefab instance clicked.");
}
Sorry if this code is weird, I am baffled. Each card is made of a UV Plane, courtesy of a graphic artist, so please go easy as I don't know anything about 3D art. Thank you so much.