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. Dismiss Notice

I know this question is repetitive through the unity answers, but can't seem to find the right idea

Discussion in 'Scripting' started by JoshMBeyer, Feb 25, 2015.

  1. JoshMBeyer

    JoshMBeyer

    Joined:
    Aug 20, 2012
    Posts:
    48
    I want an infinite platform. No gaps, just one single platform that goes on forever, well looks as if it does anyway. Think of it as a never ending road. I thought of having 2 or 3 platforms and cycling them as the user crosses one, but I would rather have it to where the players nor the platform ever actually move, it just appears that the player is moving down the road, and the objects move, then being collected and replaced or deleted as they go off screen. What would be the simplest, and quickest way of achieving this? I am open to any suggestions, just please provide some amount of detail since I am newer to programming.
     
  2. kdubnz

    kdubnz

    Joined:
    Apr 19, 2014
    Posts:
    177
  3. JoshMBeyer

    JoshMBeyer

    Joined:
    Aug 20, 2012
    Posts:
    48
  4. kdubnz

    kdubnz

    Joined:
    Apr 19, 2014
    Posts:
    177
    Your request seems contradictory.
    Do you want a platform that doesn't move or one that seems to go on for ever.

    I'm trying to imagine the overhead involved in moving all your scenery each frame.
    ... and doing it in 3d ??
     
  5. lordconstant

    lordconstant

    Joined:
    Jul 4, 2013
    Posts:
    389
    I am currently working on something similar and to get the effect you want you can do something like this:

    - Create your floor and angle the camera so you cant see anything but the floor.

    - Add a material to the floor and create a script to make the texture roll. This can be done by offsetting the texture uvs.

    - Now just create a gameobject that will be your spawnpoint and a script to do your spawning.

    - Create a script to move an object foward on the update.

    - when the object goes past the player and offscreen delete it.

    This may not be the best way to do it but it works well for me.

    Hope this helps
     
    image28 likes this.
  6. image28

    image28

    Joined:
    Jul 17, 2013
    Posts:
    457
    Quick add, deleting gameobjects is expensive, a pooling script should be used that turns the objects on and off...