using System.Collections; using System.Collections.Generic; using UnityEngine; public class TestManager : MonoBehaviour { public Transform player; public Transform enemy; public Camera mainCamera; // Use this for initialization void Start () { //mainCamera = GetComponent(); //Vector3 playerWorld = player.position; //Vector3 enemyWorld = enemy.position; //print("玩家世界位置 : x = " + playerWorld.x + ", y = " + playerWorld.y + ", z = " + playerWorld.z); //print("敌人世界位置 : x = " + enemyWorld.x + ", y = " + enemyWorld.y + ", z = " + enemyWorld.z); //Vector3 playerScreen = Camera.main.WorldToScreenPoint(playerWorld); //Vector3 enemyScreen = Camera.main.WorldToScreenPoint(enemyWorld); //print("玩家屏幕位置 : x = " + playerScreen.x + ", y = " + playerScreen.y + ", z = " + playerScreen.z); //print("敌人屏幕位置 : x = " + enemyScreen.x + ", y = " + enemyScreen.y + ", z = " + enemyScreen.z); } // Update is called once per frame void Update () { } }