Skip to content

Instantly share code, notes, and snippets.

@OutlawGameTools
Created November 21, 2015 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 OutlawGameTools/9835d949d9c104e57368 to your computer and use it in GitHub Desktop.
Save OutlawGameTools/9835d949d9c104e57368 to your computer and use it in GitHub Desktop.
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