我不明白爲什麼OnDrawGizmos()
方法在Start()
方法和Update()
方法中都沒有被調用,但它在我運行Unity項目時執行。爲什麼我在Unity中調用我的方法時,我沒有在代碼中調用它?
using UnityEngine;
using System.Collections;
public class PlayerController : MonoBehaviour
{
public Transform grounder;
// Use this for initialization
void Start() {
}
// Update is called once per frame
void Update() {
}
void OnDrawGizmos(){
Gizmos.color = Color.white;
Gizmos.DrawSphere (grounder.position, 1);
}
}
我明白了。感謝兄弟! – 2014-11-21 12:45:21