Create a gist now

Instantly share code, notes, and snippets.

Embed
Attached to an animal prefab. For the "Many Game Objects from One Prefab and an Array of Sprites" tutorial.
using UnityEngine;
using System.Collections;
public class Animal : MonoBehaviour {
private Vector2 origPos;
public string animalName;
public bool returnToOrigin = false;
void Start () {
origPos = transform.position;
}
void OnMouseUp() {
if (returnToOrigin)
transform.position = origPos;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment