Because writing code and making it all work is stressful. This be here!

08Jan/17

Screen Click on object and get its Name and Coordinates.

RaycastHit hit; void Update () { if (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1)) { Ray ray = GetComponent<Camera>().ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit)) { print(hit.transform.name); print(hit.point); //snap to grid once selected. hit.transform.position = new Vector3(Mathf.Round(hit.transform.position.x), Mathf.Round(hit.transform.position.y),Read More…

18Dec/16

Animation Based on KeyPress

public Animator Animation; public float AnimationLocation = 0f; void Start() { Animation = GetComponent<Animator>(); } void Update(){ if (Input.GetKeyDown(KeyCode.W)) { //Param: AnimationName, Layer, StartTime Animation.Play(“AnimationNameHere”, -1, AnimationLocation); } }