void Start() { tra = gameObject.GetComponent <Transform>(); shoot = tra.FindChild("ray"); m_linerenderer = shoot.gameObject.GetComponent <LineRenderer>(); //shoot为transform组件用.gameObjectke找出其上一级的物体组件 m_music = gameObject.GetComponent <AudioSource>(); //查找gamemanger m_gamemanger = GameObject.Find("UI").GetComponent <gamemanger>(); }
// Use this for initialization void Start() { //查找gamemanger脚本 m_gamemanger = GameObject.Find("UI").GetComponent <gamemanger>(); }
// Use this for initialization void Start() { sprite = GetComponent <SpriteRenderer>(); thegm = FindObjectOfType <gamemanger>(); thesound = GetComponent <AudioSource>(); }