Advertisement
thebeardphantom

GridLockedObject

Dec 3rd, 2013
405
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.33 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. [ExecuteInEditMode]
  5. public class GridLockedObject : MonoBehaviour {
  6.     void Update() {
  7.     Vector3 position = transform.position;
  8.     position.x = Mathf.Round(position.x);
  9.     position.y = Mathf.Round(position.y);
  10.     position.z = Mathf.Round(position.z);
  11.     transform.position = position;
  12.     }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement