Assets/BasketController.cs(11,26): error CS0619: UnityEngine.Component.collider' is obsolete:
Property collider has been deprecated. Use GetComponent<Collider>() instead. (UnityUpgradable)'とエラーが出ます。
using UnityEngine; using System.Collections; public class BasketController : MonoBehaviour { void OnTriggerEnter(Collider other){ if (other.gameObject.tag == "Apple") { Debug.Log ("Tag=Apple"); } else { Debug.Log ("Tag=Bomb"); } Destroy (collider.gameObject); } // Update is called once per frame void Update () { if(Input.GetMouseButtonDown(0)){ Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition); RaycastHit hit; if(Physics.Raycast(ray,out hit,Mathf.Infinity)){ float x = Mathf.RoundToInt (hit.point.x); float z = Mathf.RoundToInt (hit.point.z); transform.position = new Vector3 (x, 0.0f, z); } } } }
のように該当コードを書きました。
調べていたら、Destroy (collider.gameObject);を書き換えなければならないようですが
どう書き換えたら良いのでしょうか?
3Dゲームです。
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。