void Awake() { // get a reference to the components we are going to be changing and store a reference for efficiency purposes _transform = GetComponent <Transform>(); _rigidbody = GetComponent <Rigidbody2D>(); if (_rigidbody == null) // if Rigidbody is missing { Debug.LogError("Rigidbody2D component missing from this gameobject"); } _animator = GetComponent <Animator>(); if (_animator == null) // if Animator is missing { Debug.LogError("Animator component missing from this gameobject"); } _audio = GetComponent <AudioSource>(); if (_audio == null) { // if AudioSource is missing Debug.LogWarning("AudioSource component missing from this gameobject. Adding one."); // let's just add the AudioSource component dynamically _audio = gameObject.AddComponent <AudioSource>(); } // determine the player's specified layer _playerLayer = this.gameObject.layer; // determine the platform's specified layer _platformLayer = LayerMask.NameToLayer("Platform"); // get stats from stats manager moveSpeed = PlayerStatsManager.GetSpeed(); jumpForce = PlayerStatsManager.GetJumpForce(); doubleJumpIsUnlocked = PlayerStatsManager.GetDoubleJump(); }