void ObjFinder() { if (player == null) { player = GameObject.Find("Player"); } if (controller == null) { controller = player.GetComponent <PlayerController>(); } if (timeText == null) { toggy = this.GetComponent <ToggleUI>(); timeText = toggy.getTextObject("time").GetComponent <Text>(); } }
void ObjFinder() { //automatically find objects if (player == null) { player = GameObject.Find("Player"); } if (playerSpeed == null) { playerSpeed = player.GetComponent <Rigidbody2D>(); } if (controller == null) { controller = player.GetComponent <PlayerController>(); } if (speedTxt == null) { toggy = this.GetComponent <ToggleUI>(); speedTxt = toggy.getTextObject("speed").GetComponent <Text>(); } }