void Start() { //Instantiate Camera & player cam = Instantiate(cam); Player = Instantiate(Player); Player.AddComponent <PlayerMovement>(); PlayerInstanceMovementScript = (PlayerMovement)Player.GetComponent(typeof(PlayerMovement)); PlayerInstanceMovementScript.addCamera(cam); coinControlScript = new CoinControl(); //Instantiate score //Score ScoreScript = (Score)Player.GetComponent(typeof(PlayerMovement)); //ScoreScript.addPlayer(Player); //Initate image control playerMarketScript = (PlayerMarket)Player.GetComponent(typeof(PlayerMarket)); playerMarketScript.setPlayer(Player); //get darkness script darknessOverlayObject = Instantiate(darknessOverlayObject); darknessOverlayScript = (DarknessOverlay)darknessOverlayObject.GetComponent(typeof(DarknessOverlay)); //Instantiate backgounds BackgroundImageFirst = Instantiate(BackgroundImageFirst); BackgroundImageSecond = Instantiate(BackgroundImageSecond); //add parallax Player.AddComponent <Parallax>(); ParallaxScript = (Parallax)Player.GetComponent(typeof(Parallax)); ParallaxScript.Construct(BackgroundImageFirst, BackgroundImageSecond, cam); //add camera component to movement controls PlayerControlsScript = (PlayerControls)Player.GetComponent(typeof(PlayerControls)); PlayerControlsScript.addCamera(cam); //get start positions startPosPlayer = Player.transform.position; backgroundPos1 = BackgroundImageFirst.transform.position; backgroundPos2 = BackgroundImageSecond.transform.position; //Start game startGame(); }