小编Rea*_*Gas的帖子

Termux无法运行C ++程序?

所以我在android上使用clang ++和termux编译了一个简单的cpp程序,但是我无法运行该程序,出现以下错误:

 $ ./execname
-bash: . /execname: Permission denied 
Run Code Online (Sandbox Code Playgroud)

c c++ terminal android clang++

3
推荐指数
1
解决办法
2582
查看次数

IndexOutOfRangeException:尝试访问GameObject数组时,数组索引超出范围?

所以我试图从FindGameObjectsWithTag初始化的GameObject数组中访问一个元素,但是我收到以下错误

"IndexOutOfRangeException:数组索引超出范围.",

当我打印数组的长度时,我得到3,应该是.我如何解决它?

public class selectObject : MonoBehaviour {
    // Use this for initialization
    public GameObject[] objects;
    void Start () {
        GameObject[] objects = GameObject.FindGameObjectsWithTag("isari");  
        Debug.Log (objects.Length);
    }

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

        if (Input.GetMouseButtonDown(0))
        {
            Debug.Log("Mouse is down");

            RaycastHit hitInfo = new RaycastHit();
            bool hit = Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hitInfo);
        if (hit) 
        {
            Vector3 position = hitInfo.transform.gameObject.transform.position;
            Quaternion rotation = hitInfo.transform.gameObject.transform.rotation;
            Debug.Log("Hit " + hitInfo.transform.gameObject.name);
            Object.Instantiate (objects[0], position,rotation);

            Object.Destroy (hitInfo.transform.gameObject);

            if (hitInfo.transform.gameObject.tag == "Construction")
            { …
Run Code Online (Sandbox Code Playgroud)

c# scope unity-game-engine

1
推荐指数
1
解决办法
444
查看次数

标签 统计

android ×1

c ×1

c# ×1

c++ ×1

clang++ ×1

scope ×1

terminal ×1

unity-game-engine ×1