public void thign() { tunnelCreator = GetComponent <TunnelCreator>(); tunnelCreator.CreateSineTunnel(); player = playerGO.GetComponent <Player>(); playerGO.transform.position = new Vector2(4, tunnelCreator.length + 50); }
// Use this for initialization void Start() { // Check if instance already exists if (instance == null) { // if not, set instance to this instance = this; } // If instance already exists and it's not this: else if (instance != this) { // Then destroy this Destroy(gameObject); } tunnelCreator = GetComponent <TunnelCreator>(); tunnelCreator.CreateSineTunnel(); player = playerGO.GetComponent <Player>(); playerGO.transform.position = new Vector2(4, tunnelCreator.length + 50); }