I currently am using a 2d sprite as the background and want to achieve a sort of parallax effect(though just having the sprite move to some point and being updated back to its starting point would be fine too).
How can I make it appear as if the player is infinitely moving forward when reality it is the background looping? I want to stick with 2d sprite as the bg so long as it doesn’t pose any performance issues on mobile by modifying its position often. Not sure what’s optimal or if I should even worry about it at my early knowledge of unity.
What I have tried:
Using a texture (jmported bg image) applied to a quad with a directional light. This didn’t work for me as it covered my player and enemy sprites and/or left a flare effect even though I made sure to not enable the flare (or at least I thought so).
In our game we use 2 sprites for the background. The same image obviuously, and we use a looped animation.
When the first image goes out of the camera bounds, it comes back to the start position. Both scrolls and the mechanism is the same.
You don’t have to worry about scripting or something.
If you want it to scroll when the game is paused just set the animator and set the time from normal tu unscaled.
You can control the speed by script
(Dont change it every frame, or you’ll have impact on performance)
Just play a bit with this, try and see if it works.
Hope it helps
I forgot to say that you have to attach the gameobject with those 2 sprites to the camera, because if you don’t do that they will be in world position and dont follow the camera
I did something similar in one of my games ones. You had the right idea but you have to use a Unlit shader in order to prevent the light from having any effect (I believe that is what you are trying to accomplish right?).