using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Change : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
transform.Rotate(-Input.GetAxis("Mouse Y"), Input.GetAxis("Mouse X"), 0);
transform.eulerAngles = new Vector3(transform.eulerAngles.x, transform.eulerAngles.y, 0);
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Change : MonoBehaviour {
GameObject btn;
// Use this for initialization
void Start () {
btn = GameObject.Find("Canvas").transform.GetChild(0).gameObject;
btn.GetComponent<Button>().onClick.AddListener(MoveQJ2);
}
public void MoveQJ2()
{
transform.position += Vector3.right * 20;
}
// Update is called once per frame
void Update () {
transform.Rotate(-Input.GetAxis("Mouse Y"), Input.GetAxis("Mouse X"), 0);
transform.eulerAngles = new Vector3(transform.eulerAngles.x, transform.eulerAngles.y, 0);
}
}
Unity 2017.4.36