My Editor Script for creating Parallax Backgrounds
Andrew Velez Posted on 12/16/2018
Base Material: This is the material that will be applied to all the objects that get created by the tool. (Code can be changed to also add a bump map, etc).
Bounding Shape 2D: This is just like Cinemachine if you have used that. This is a collider representing the bounds of the world.
Example of Bounding Box
Follow: The script uses this object to determine how much to tile the scrolling background. For example: if you have the camera at position.x at 100 and the bounding box goes from 0 to 200 then that means the player/camera is currently in the middle of the map. If you set the Speed value for the image to be 3 that would mean its looping three times across the map. That would mean if the player is at 100 the image just finished its first loop.
Textures: The background image. Using opacity you can make it so that clouds and birds are moving.
Speed: How many times the image will loop inside the bounds. Also determines how fast backgrounds are that scroll infinitely. Example: if you have set to 1 that means it basically wont move and it'll stay the same location as the moving object. 2 would mean that if you walked from the left most x on the map to the right most x than you would see the image twice.
Moving: whether or not the image will scroll infinitely. If true the image will move to the left even if you are standing still. If this is false the image will only move if the follow object moves within the bounds.
Create/Update Backgrounds: Depending on whether this is your first time generating the files there will be different buttons available for use. When you click either of these buttons it will generate all the game objects containing all the images with all the code needed to have parallax scrolling.