private void Start() { // Get the catManager if (GameObject.Find("CatManager") != null) { catManager = GameObject.Find("CatManager").GetComponent <UICatSelect>(); // Set the correct cat switch (this.gameObject.tag) { case "playerOne": catData = catManager.playerOne; break; case "playerTwo": catData = catManager.playerTwo; break; } } // Get the sprite renderer spriteRenderer = this.gameObject.GetComponent <SpriteRenderer>(); // Set the sprite spriteRenderer.sprite = catData.sprite; // Set the scale transform.localScale = catData.size; // Add the collider // Unity automatically sets the collider to equal the sprite this.gameObject.AddComponent <PolygonCollider2D>(); }
private void Start() { DontDestroyOnLoad(this.gameObject); if (catManagerInstance == null) { catManagerInstance = this; } else { Object.Destroy(this.gameObject); } }
// Start is called before the first frame update void Start() { catManager = GameObject.Find("CatManager").GetComponent <UICatSelect>(); catManager.playerSelecting = 1; }
private void Start() { catManager = GameObject.Find("CatManager").GetComponent <UICatSelect>(); }