//Initialize things on the global scale. void Awake() { //Setup singleton here. if (master == null) { master = this; DontDestroyOnLoad(this); DontDestroyOnLoad(this.gameObject); } else if (master != this) { Destroy(this); } //Raycasts ignore the ignoreRaycast, select character, and non-draggable area layers. regularCharacterMask = ~0 & ~((1 << 2) | (1 << 10) | (1 << 11) | (1 << 12)); //Raycasts ignore the ignoreRaycast, selectCharacters, and other characters. draggedCharacterMask = ~0 & ~((1 << 2) | (1 << 10) | (1 << 8)); //Ignore collision between characters and the selected characters. Physics2D.IgnoreLayerCollision(8, 10, true); Cursor.SetCursor(cursorTexture, new Vector2(13, 13), CursorMode.Auto); MusicLooper.loadAudioClips(); }
void Awake() { // First, check if there are any other instances conflicting. if (Instance != null && Instance != this) { // If so, destroy other instances. Destroy(this.gameObject); } //Save our singleton instance. Instance = this; DontDestroyOnLoad(this.gameObject); }
//Initialize things on the global scale. void Awake() { //Setup singleton here. if (master == null) { master = this; } else if (master != this) { Destroy(this); } //Raycasts ignore the ignoreRaycast, select character, and non-draggable area layers. regularCharacterMask = ~0 & ~((1 << 2) | (1 << 10) | (1 << 11) | (1 << 12)); //Raycasts ignore the ignoreRaycast, selectCharacters, and other characters. draggedCharacterMask = ~0 & ~((1 << 2) | (1 << 10) | (1 << 8)); //Ignore collision between characters and the selected characters. Physics2D.IgnoreLayerCollision(8, 10, true); }