Changing Player Starting Position if user watches a Rewarding adv.

Hi everyone,
Before I ask my question let me just explain my current scenario, so I am working on a game, for the purposes of the question lets say its an endless runner game. I want to add a feature that when a player dies, they can watch a rewarding ad and start at 500 meters rather than 0. I currently have the ads and the buttons set up for this, and my only issue is how to actually call the scene and then alter the player position. The current code that I have changes the position for a split second and then for some reason it goes back to normal. Please let me know what I can do to fix this.
Thanks in advance

Hey! Can you post this code here?
Without it, all i can assume is that you are calling the correct starting pos (500) and then start the game anyway with the default position (0).

Use a bool to check if the ad was watched or not and set the starting position inside an if/else:

if(watchedAD)
{
startPos = 500;
}
else
{
startPos = 0;
}
1 Like

Thanks for your reply, I don’t have an issue with setting it after the ad, but I think my error is what you just explained, how can I change the starting position? For now, I am doing the following

SceneManager.LoadScene("SceneName");
temp.x = 0;
temp.y = 0;
temp.z = 500;
player.transform.position = temp

this does change the position for like a split second once the scene is loaded, but then it goes back to 0

Can you share the part of the code where the game (level) starts? You are setting it correctly before but your game-logic is starting at 0 anyway, so you most likely are setting the player.transform.position inside the game-routine to start at 0, regardless of the position you have set prior.

Thank you so much, but I managed to find another way of doing what I wanted to do. I decided to just add an upward force on the player after the ad is watched, so they kind of get to view the world from above, while still starting at position 500 (or any position depending on the force.
Thank you again.

1 Like