void PopulateInitialReferences() { // find the golf ball in the scene and save reference m_golfBall = GameObject.FindGameObjectWithTag("GolfBall").GetComponent <GolfBallScript>(); if (m_golfBall == null) { Debug.LogWarning("Ball Not Found"); } else { Debug.Log("Ball Found"); } }
void Start() { GameObject[] UIObjs; ballScript = golfball.GetComponent <GolfBallScript>(); ballBody = golfball.GetComponent <Rigidbody>(); curState = SliderState.WAITING; UIObjs = GameObject.FindGameObjectsWithTag("UI"); for (int i = 0; i < UIObjs.Length; i++) { if (UIObjs[i].name == "PowerSlider") { PowerSlider = UIObjs[i].GetComponent <Slider>(); } if (UIObjs[i].name == "ClubName") { clubName = UIObjs[i].GetComponent <Text>(); } } }
// Use this for initialization void Start() { myBallScript = GetComponentInParent <GolfBallScript>(); myBody = GetComponentInParent <Rigidbody>(); }