void Awake() { //assign an instance of this gameobject if it hasn't been assigned before if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } DontDestroyOnLoad(this); }
void Awake() { stats = GetComponent <PlayerStats>(); m_CurrVerticalSpeed = m_VerticalMoveSpeed; m_CurrHorizontalSpeed = m_HorizontalMoveSpeed; m_Rigidbody = GetComponent <Rigidbody2D>(); m_SpriteRenderer = GetComponent <SpriteRenderer>(); m_PlayerScaler = GetComponent <PlayerScaler>(); m_PlayerDecorations = GetComponent <PlayerDecorations>(); shouldRotateInTowardTargetPosition = true; m_TouchPulseSprite = Resources.Load <TouchPulse>(Utility.PrefabFinder.PREFABS + "TouchPulseSprite"); m_ShinyEffect = GetComponentInChildren <_2dxFX_Shiny_Reflect>(); }