当前位置:网站首页>Unity3d learning notes

Unity3d learning notes

2022-07-05 04:51:00 shixch

Specify the location of the object :

using UnityEngine;

public class Box : MonoBehaviour
{

public GameObject first;

    // Start is called before the first frame update
    void Start()
    {
        first.transform.position =new Vector3(first.transform.position.x,1.5f,
            first.gameObject.transform.position.z); 
        print("x The coordinates of are :"+first.gameObject.transform.position.x);
        print("y The coordinates of are :"+first.gameObject.transform.position.y);
        print("z The coordinates of are :"+first.gameObject.transform.position.z);


    // Update is called once per frame
    void Update()
    {        
    }
}

-----

public void tuichu() // Exit app
    {
        Application.Quit();
    }

-----

Create a new one 『 Button 』, Create a new script , Give the script to the button ,​​​​​​​

 

  public void Click_test_s()  // Prompt window
    {
        UnityEditor.EditorUtility.DisplayDialog(" title ", " Prompt content ", " confirm ", " Cancel ");
    }

原网站

版权声明
本文为[shixch]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202140628017874.html