Advertisement
bilasi

c# lab

Nov 2nd, 2016
454
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.69 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class a : MonoBehaviour {
  5.  
  6.     Vector3 temp;
  7.     float halfW;
  8.     float halfH;
  9.     void Start () {
  10.         Debug.Log(Screen.width);
  11.         Debug.Log(Screen.height);
  12.  
  13.  
  14.  
  15.     }
  16.    
  17.     // Update is called once per frame
  18.     void Update () {
  19.             //temp.x+=0.2f;
  20.        
  21.             //temp.y += 0.2f;
  22.             //temp.z += 0.6f;
  23.  
  24.         //temp.x = Input.mousePosition.x;
  25.         //Debug.Log(Input.mousePosition.x);
  26.         //transform.position = temp;
  27.         halfW = Screen.width/2;
  28.         halfH = Screen.height/2;
  29.      transform.position = new Vector3(Input.mousePosition.x-halfW, 0.0f,Input.mousePosition.y-halfH);
  30.  
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement