Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Player Speed and Spawnpoint positioning

Discussion in 'Scripting' started by DaRealMik, May 24, 2020.

  1. DaRealMik

    DaRealMik

    Joined:
    Jul 27, 2019
    Posts:
    69
    So I have a combination of anchors and a canvas with scale with screen size to make sure everything fits onto the screen. In my game I also have 5 spawnpoints for things to drop out of. These spawnpoints don't adjust to the size of the canvas, making the game unplayable and weird. How can I make sure that the spawnpoints adjust to the canvas?
    upload_2020-5-24_12-3-56.png
    The dot on the top is the middle spawnpoint.

    I also have a player in the form of a bucket. How can I adjust the speed variable in my script to work well with the size of the canvas?

    Thanks.
     
  2. WarmedxMints

    WarmedxMints

    Joined:
    Feb 6, 2017
    Posts:
    1,035
    you can get the current screen size and calculate a position based on that. Have to ask though, why are you using the canvas for your moving objects and not a sprite on a gameobject in world space?
     
  3. DaRealMik

    DaRealMik

    Joined:
    Jul 27, 2019
    Posts:
    69
    Thanks for the help! I'm not sure on how to do that, so I would really appreciate some help. As for the canvas, this is my first game and I'm still learning Unity so I didn't do this. Perhaps I will implement that somehow.
     
  4. DaRealMik

    DaRealMik

    Joined:
    Jul 27, 2019
    Posts:
    69
  5. DaRealMik

    DaRealMik

    Joined:
    Jul 27, 2019
    Posts:
    69
    I just realized that the position of the canvas changes with the size. Is there any way to get around this with reference to my problem above?