// Turns the player in the same direction as the polygon void InputForPlayerGameObject() { PlayerBehaviour p = GameObject.FindGameObjectWithTag("PlayerParent").GetComponent <PlayerBehaviour>(); if (p != null) { p.speed = p.Direction(speed); } else { Debug.Log("Something went wrong"); } }