Unity Tutorial: Infinitely Scrolling Background [Starfield for Space Games]

  Рет қаралды 144,193

quill18creates

quill18creates

Күн бұрын

Пікірлер: 203
@agenttatsu
@agenttatsu 8 жыл бұрын
This tutorial could not have been more concise and to-the-point. At 20:24 I looked over at your scene view and the biggest smile just starts spreading across my face because this is EXACTLY what i was looking for. So perfect, words can't even begin to describe it. Thank you so much.
@dominiquecataquez1638
@dominiquecataquez1638 2 жыл бұрын
For those people having stripes in their image when offset is 1, set the wrap mode to repeat in your image.
@DmanGames
@DmanGames Жыл бұрын
the code looks like this: mat.mainTexture.wrapMode = TextureWrapMode.Repeat;
@AustinTJanzen
@AustinTJanzen Ай бұрын
Bless you
@donloh7454
@donloh7454 6 жыл бұрын
2017 - set the wrap mode repeat to work well ;)
@eliahreeves3739
@eliahreeves3739 5 жыл бұрын
thanks
@ukrainecmk
@ukrainecmk 5 жыл бұрын
Thnx :)
@chiperchiper1782
@chiperchiper1782 5 жыл бұрын
what is wrap mode?help me please my texture rendering bad
@happym0nk3y
@happym0nk3y 5 жыл бұрын
@@chiperchiper1782 wrapMode is a property on the texture, you can set it in code with 'material.mainTexture.wrapMode = TextureWrapMode.Repeat;'
@PauloHenrique-jr7ir
@PauloHenrique-jr7ir 5 жыл бұрын
Ahh you are my hero, man!! Thanks, wasn't able to find the solution! 🤜🤛
@MooseyGaming
@MooseyGaming 10 жыл бұрын
'relatively quick tutorial' - 26 minutes :D always seems to be the way!
@muddro420
@muddro420 10 жыл бұрын
only one part
@moosesnWoop
@moosesnWoop 4 жыл бұрын
Thought it would be like 4 mins lmao but for this type of effect and build it's actually really concise
@eugenekalnitski1517
@eugenekalnitski1517 5 жыл бұрын
Thanks! Works even 5 years later on Unity 2019.2.5. Helped me a lot.
@mosysaurusrex
@mosysaurusrex 5 жыл бұрын
same here!
@notpaul9637
@notpaul9637 8 жыл бұрын
Love the effect this made. Sure there may be an easier way to do this but it is so light and easy enough it can be added to a project pretty quickly.
@wigwam4you
@wigwam4you 4 жыл бұрын
Thanks! Quick Tip for using this with LWRP / URP (Unity 2019.3.15f1) - The mainTextureOffset Property does not seem to work properly, since the new value is not set and the texture does not move. The offset must be accessed via the the Methods material.GetTextureOffset("_BaseMap"); and material.SetTextureOffset("_BaseMap", offset);
@adambenk0
@adambenk0 4 жыл бұрын
I have spent literally 3 hours wondering in agony, why it is not working......Thanks mate, you just saved my sanity.
@DHofmann
@DHofmann 8 жыл бұрын
Very intuitive and at the same time easy to follow.Best understandable tutorial on this effect I found on KZbin so far.
@StraightTomahawk
@StraightTomahawk 4 жыл бұрын
Fantastic video, all these years later it's still helpful!!
@nfenton
@nfenton 9 жыл бұрын
I had been trying to get this to work for a few hours and then came across your video. Thank you so much!
@gabsdonati
@gabsdonati 2 жыл бұрын
OMG THANK YOU! Been looking for something like this, but can`t find anything on it. Especially something recent! Who would've thought that a KZbin video from 2014 would still be THIS RELEVANT! Amazing, great job! Efficient Easy Timeless
@wgw4
@wgw4 10 жыл бұрын
Loving the fact that you put up more content on this channel! Keep it up!
@jennysun4665
@jennysun4665 7 жыл бұрын
Thank you so much with your tutorial. I actually couldn't find a good infinite scrolling tutorial for both horizontal and vertical. Your tutorial helped me a lot with creating my game for my assignment. Thank you so much! Keep up the great work!
@julezgermany5839
@julezgermany5839 4 жыл бұрын
2020 - still works well :) "set the wrap mode repeat to work well" -Don Loh 2017 Thanks mate!
@lucas90gs
@lucas90gs 4 жыл бұрын
How did you manage to apply a Sprite to the Material?
@zuzieeeeee
@zuzieeeeee 2 жыл бұрын
I've been searching hours for exactly this
@tonyfweb
@tonyfweb Жыл бұрын
Fucking legend! I've been breaking my head for the last two weeks to get this very effect and hadn't been successful. I even opted to ask ChatGPT and it wasn't understanding me. I can't believe this video is so old yet so useful. It's late so I won't be trying it till tomorrow but holy shit. You are my god damn hero!
@AlSamZar
@AlSamZar 7 жыл бұрын
That's why I fell in love in game development, you get to engineer your solutions like this, I hope I have your expertise someday ! thx a lot for this.
@PixelMake
@PixelMake 6 жыл бұрын
Hi Alaa we have some free ships and asteroids and other assets for your games on our channel & tutorials best of luck with your project. if you do decide to use our stuff we would love to see your creations tweet or message us on facebook Instagram . stay awesome!
@theral056
@theral056 9 жыл бұрын
Awesome tutorial. Looks like something basic, which I had no idea how I would solve, explained to me in 26 minutes and easy to replicate for great effect. Awesome!
@theycallmemrglass
@theycallmemrglass 5 жыл бұрын
wow, this tutorial turns out to be so much more than just a scrolling background! You should have called this "How to build the core element of a Parallax Scrolling Game!" - I am suddenly having a urge to develop an R-Type game...ah memories.
@lehula
@lehula 8 жыл бұрын
This is exactly what I was looking for. You also did the parralax effect. Next beer is on me!
@alexleonardi2
@alexleonardi2 7 жыл бұрын
This is an absolutely AMAZING tutorial! Thank you so much! The parallax effect was awesome! You are great
@VergilxUA
@VergilxUA 10 жыл бұрын
Lovely tutorial, quite enjoyed the solution for this type of parallax effect
@ruzzyshuya4832
@ruzzyshuya4832 8 жыл бұрын
Cheers Quill. I just got Unity and making some things to go along with your simple space shooter tutorial and this fits right in with my idea :)
@Kamus1952
@Kamus1952 6 жыл бұрын
How to make it as a background. It cover my UI elemtns, which are not visible.
@QuotenLP
@QuotenLP 9 жыл бұрын
I have a problem with it: My offset is not infinitely. For example if I change my Offset to 1 the texture is gone. I also use the unlit shader but its also not working on all of the others. Please help me.
@cristhiandiaz3683
@cristhiandiaz3683 9 жыл бұрын
+Tim Lange did you fix it?? I have the same problem
@iskandarshabaev
@iskandarshabaev 9 жыл бұрын
+Cristhian Diaz in texture settings: Wrap Mode = Repeat
@colbymaulden7357
@colbymaulden7357 9 жыл бұрын
+Iskandar Shabaev i have the same problem, but it still does the same thing even after changing the wrap mode to repeat
@QuotenLP
@QuotenLP 9 жыл бұрын
Colby Maulden Setting wrap mode to repeat fixed it for me. Thanks a lot!
@a.c.bonneville189
@a.c.bonneville189 8 жыл бұрын
thanks bro
@andythayer5493
@andythayer5493 4 жыл бұрын
Great video. As always, Quill18 vids show the way (at least to us amateurs).
@jedrzejwysocki5584
@jedrzejwysocki5584 3 жыл бұрын
EXACTLY what I needed. Plus very informative. Good job, sir!
@noreasonchannel4012
@noreasonchannel4012 6 жыл бұрын
its 2018and still the best...Amazing! Keep making more!
@cheshire_cat_311
@cheshire_cat_311 10 жыл бұрын
That parralax was such a great feature
@trashgamedev
@trashgamedev Жыл бұрын
a bit long-winded but a great looking effect that's simple to make, thanks a lot!
@gregmumbai333
@gregmumbai333 10 ай бұрын
This is obviously a very old video but it was helpful for jump starting a few ideas for me. If anyone wants to decouple the camera from the player but still have the option of tracking the player with the camera you can try this: Make a follow script and attach it to the camera and then feed in the position of the player as a vector and move the camera using a lerp function: trackingPosition = player.transform.position; transform.position = Vector3.Lerp( transform.position, trackingPosition, trackingSpeed * Time.deltaTime ); trackingPosition is the player position modified so they don't end up totally on top of each other and the ship is positioned in frame: trackingPosition.z = trackingPosition.z - 10; Then you can also create a bool to turn the tracking on and off and put it in a function so you can switch between a fixed camera and a tracking camera. Not sure if that is useful to anyone but it's where my mind went. Also, there are probably better ways to do but it works as a starting point.
@KyleRebstock
@KyleRebstock 6 жыл бұрын
This is better than I was looking for. It's a bit old though and I kinda expect things to be different now, which I will probably be able to figure out the rest. Nonetheless awesome video!
@hamilaibrahim4171
@hamilaibrahim4171 5 жыл бұрын
I got white lines after moving some time help me
@jok5643
@jok5643 3 жыл бұрын
Wow suuuuch a great tutorial! Tip* for newer versions of unity use "default" for the texture image
@nileriversoftware4070
@nileriversoftware4070 3 жыл бұрын
A plane could potentially use less resources if it is very large, and only part of it is visible. Unity might have better occlusion culling when the square is divided up into more polygons.
@Pinkhair3d
@Pinkhair3d 10 жыл бұрын
There's an even easier way to handle it- put on a shader that uses world coordinates for the UVs and make the quad the child of the camera, and it will always match perfectly for any speed or rotation with no particular scripting.
@quill18creates
@quill18creates 10 жыл бұрын
Shaders are scary.
@mystirboy
@mystirboy 8 жыл бұрын
Life saver! I've been trying to figure out how to implement a parallax with an infinite background and my solution was just to object pool the background but really messed up my parallaxes.
@aztecGin
@aztecGin 4 жыл бұрын
Wow sir, it is amazing. You just ruined my work moral for today, I want to go home and try it on my spacecraft project. Woha that tweak in the end would highly improve my game UX. Love it! :D
@Sicklymade
@Sicklymade 10 жыл бұрын
thanks for this! was trying to copy your dig game you made for lundum dare and create/destroy quads as you moved. But this is soooo much more lightweight. Thank you :)
@dorondavid4698
@dorondavid4698 5 жыл бұрын
This was extremely clear and very well explained... Great job!
@MadDeuceJuice
@MadDeuceJuice 7 жыл бұрын
the parallax effect makes it look like you're going at many multiple times the speed of light
@programer1337
@programer1337 10 жыл бұрын
Congrats!!! Great tutorial. I was wondering if some times in the (I hope) near future you could do a tutorial with some gravity tricks. For example gravity points where you in game create an attack and create that point and pull all near objects to it and it explodes dealing some damage or something like that. Gravity is really usefull and it would be great to have one great tutorial as all of your tutorials by now :)
@justincudney2627
@justincudney2627 10 жыл бұрын
To do that you can just use bits of this tutorial and the space game tutorial, combine it together and you get a top down RPG
@Oxmond
@Oxmond 4 жыл бұрын
Oldie but goodie! Still a really nice tutorial 👍🤓
@ProximaS
@ProximaS 4 жыл бұрын
remember change Wrap mode in Texture to Repeat*
@Ami-Wishes
@Ami-Wishes 10 жыл бұрын
Thanks for this, and all tutorials you do haha. Also, I can't wait to get Unity Pro. It's gunna be so great
@MattMajcan
@MattMajcan Жыл бұрын
did everything right but when in the actual game it just turns black
@bandolero818
@bandolero818 9 ай бұрын
Hey! Many thanks ! Love the effect and you explained so well. Good luck!
@atirathk
@atirathk 8 жыл бұрын
At 11:49, why doesn't the program work if you merely type float scrollSpeed = 1.0f mat.mainTextureOffset = offset * scrollSpeed with the scrollSpeed increasing every few seconds by 0.1, why doesn't the program work?
@niwhalegaming
@niwhalegaming 3 жыл бұрын
hey nice video but when im moving my shader offset, my texture don't repeat, i get a color only, why ?
@vibehub5005
@vibehub5005 3 жыл бұрын
I’m having the same issue did you figure out how to solve this?
@Venky.Arisko
@Venky.Arisko 7 ай бұрын
how to fix if ship rotate, background rotate too?
@baconmanbacon303
@baconmanbacon303 4 жыл бұрын
after i get the material loaded the way u say I hit the play button and when it starts insted of a continues stars I get a look the looks like u are streching the lat row of stars out like spagetti any resone whay this is happening???
@jocopowell
@jocopowell 3 жыл бұрын
Could you use the same Starfield images, but flip one, to eliminate the blurry effect?
@Dave-xp3xg
@Dave-xp3xg 4 жыл бұрын
hey how do you make it go scroll vertical?
@aussiedev5930
@aussiedev5930 10 жыл бұрын
awesome as always, mega space game 3d v1 here I go. Great tutorial Quill,
@DieEineTomate
@DieEineTomate 8 жыл бұрын
Hey, what if i dont want to parent the Cam directly to the spaceship? I can't figure out an solution... couldt you help me please?
@maykefernandesdossantos7374
@maykefernandesdossantos7374 2 жыл бұрын
When comes down to performace is this approach better than having multiple background been intantiated and excluded like in the unity official tutorial?
@JohnSmithULIR0
@JohnSmithULIR0 8 жыл бұрын
Another thing, if I want to create an infinite scrolling background for a 2D project, will a Quad work as well? or do I have to use another Object?
@mikhailharris8480
@mikhailharris8480 7 жыл бұрын
Hey mate, i'm trying to use it in 2d Unity but for it only work vertically if i fly my spaceship upwards, when turning the starfield seems turning but my spaceship stays vertically(static). LOL
@HeraxMimar
@HeraxMimar Жыл бұрын
When i change the diffuse it turn into pink. Help please
@kianheus2487
@kianheus2487 9 жыл бұрын
I have a problem. Whenever i create a new material, the shader is set to standard, and I can't figure out how to change it to diffuse. HALP!
@igd1591
@igd1591 3 жыл бұрын
Still a cool tutorial in 2021!
@aspenmallery
@aspenmallery 7 жыл бұрын
I'm interested to see how you'd implement this method in a 3d enviroment with planets and other models. It seems like this would work best for platformer or top down shooters. I wonder if you could apply the same technique to a starey skybox for real 3d stuff
@aussiedev5930
@aussiedev5930 10 жыл бұрын
I worked out how to change the default Monodevelop script file so you can have it formatted how you like as a default. Just go into your Unity-installation-folder and navigate to "/Editor/Data/Resources/". There you will find all templates. Copy and paste the file in another directory so you can edit the file. Change the contents how you like, then save and copy and paste back into the "/Editor/Data/Resources/ folder. It would not allow me to edit the file in Program Files even with Administrator privileges, that's why I copied the file into another folder then edited it. I hope this helps :)
@colbymullenix9140
@colbymullenix9140 7 жыл бұрын
excuse me, but is it possible to apply parallax scrolling to scaling and rotating an object? For example, when you move up on the Y-axis, the texture moves forward, but when you move either left or right on the X-axis the texture rotates left or right respectively.
@TheNamesJT
@TheNamesJT 5 жыл бұрын
I think the space game nova raider does this effect, but they have planets and other things in the background too
@gluedtogames
@gluedtogames 9 жыл бұрын
Can you use this for an sidescrolling endless runner, but set the parallax effect to only work on the x position?
@IlIamo
@IlIamo 2 жыл бұрын
Wow, thanks alot. This was exactly what I was looking for dude
@virendrabhoriwal426
@virendrabhoriwal426 6 жыл бұрын
Hi Sir, Could you please help me out in changing background at runtime during background scroll. What I wanna to show - during scrolling background, I need attached scrolling i.e. one texture comes after another and continue to scroll with 2nd background. Sorry for bad english. I hope you got my point. Please help.
@stevencardwell4616
@stevencardwell4616 10 жыл бұрын
would it be possible to make a particle emitter emit on keypress only like for moving in z axes ? thanks
@kooky216films5
@kooky216films5 10 жыл бұрын
I'm using the BG to scroll down over time, works great. I need to move the camera horizontally using player input (like an old shmup) and i'm stuck!
@rkpixeldesign
@rkpixeldesign 6 жыл бұрын
Great tutorial exactly what I was looking for thanks.
@pnvgordinho
@pnvgordinho 9 жыл бұрын
Hello, Can I ask a question that maybe stupid?. I don't know much of unity and I was wondering if the particles system can emite different sprites like 2 stars with different colors?. Thanks.
@suppermanzzzz291
@suppermanzzzz291 8 жыл бұрын
That exactly what i want, thank you to share the idea
@petertodorov5592
@petertodorov5592 4 жыл бұрын
i dont know how to start - how to import my texture as a texture and how to make it so my 3d game is 2d :/
@victorvlugt7791
@victorvlugt7791 4 жыл бұрын
Thank you!! Using this to make the menu in my among us 3d. Also implemented parallax, which is pretty easy to do by using mutliple layers and giving them a different speed.
@yashwanthd1998
@yashwanthd1998 4 жыл бұрын
Tried whole day getting that effect in 2d.does it work in 2d.pls rly
@teckset5821
@teckset5821 4 жыл бұрын
the y coordinate doesn't work for me can anyone help me
@CorruptedNuk3r
@CorruptedNuk3r 10 жыл бұрын
Can you make a tutorial for how to add a text-chat?
@JonathanGorr
@JonathanGorr 9 жыл бұрын
Hi Quill. Great tutorial! Do you know how this method can be applied to textures that are also moving on their own- say comets or astroids?
@cristhiandiaz3683
@cristhiandiaz3683 9 жыл бұрын
when I increase the offset number it moves but the img is completely black in the space I moved any ideas???
@achmedauditguy2271
@achmedauditguy2271 8 жыл бұрын
I might be a bit late :-) Go to the texture and set the WRAP to REPEAT (instead of CLAMP). Should fix it.
@gjergjkadriu9460
@gjergjkadriu9460 2 жыл бұрын
8:44 material ✨
@budnicholson1
@budnicholson1 10 жыл бұрын
i cant get it to scroll i did everything the way you did but cant get it to do a thing
@mikhailharris8480
@mikhailharris8480 7 жыл бұрын
Not work with 2d Unity. the star seems good when go vertical/-vertical, but when i want to turn my spaceship it won't turn but the starfield background move according to my turn. Really need a PRO here, cuz im so noob in scripting. lol
@exstraninja7647
@exstraninja7647 5 жыл бұрын
My quad just rotates sideways so it's stuck there forever
@videomasters2468
@videomasters2468 10 жыл бұрын
awesome tutorial, really made me want to make a parallax scrolling game :)
@humbertomatias
@humbertomatias 9 жыл бұрын
Do you have any game so I can download on Iphone/ipad/steam? I mean, I love your videos and I'd love to download some of your work.
@gooball
@gooball 6 жыл бұрын
I was fearing for my life these last few days thinking of how I was going to do this. Making a infinite background with objects in new positions after moving out of the screen was already problematic with making a flappy bird game. But this.... THIS!... this made me go: "hwhawt, this is possible!? This is genius!" Thank you, kind Sir, you saved me... lots of hours of hair pulling and teeth grinding.
@entitydotexe6138
@entitydotexe6138 3 жыл бұрын
Just what I needed. Unfortunately, you're adding too many details to the video so it took me quite too long to comprehend the essence
@stevencardwell4616
@stevencardwell4616 10 жыл бұрын
thanks for this amazingly creative solution nice one keep them coming.
@alexanderwilson5659
@alexanderwilson5659 5 жыл бұрын
exactly what i was looking for, ty.
@Rajenp0
@Rajenp0 6 жыл бұрын
Amazing video, subscribed! But one question, why doesn't this work very well for mobile devices, the background is very slow and choppy?
@ImD3VI
@ImD3VI 4 жыл бұрын
very informative and easy to follow.
@BeAltyrnative
@BeAltyrnative 8 жыл бұрын
mine pulls the stars and stretches them across the screen, looks very weird instead of scrolling, help would be appreciated
@tisaconundrum
@tisaconundrum 8 жыл бұрын
answers.unity3d.com/questions/775619/texture-stretches-when-tiled-in-editor.html
@PixelMake
@PixelMake 6 жыл бұрын
we have some free ships and asteroids and other assets for your games on our channel & tutorials best of luck with your project. if you do decide to use our stuff we would love to see your creations tweet or message us on facebook Instagram . stay awesome!
9 жыл бұрын
reference behavior missing?
@sebsunda
@sebsunda 10 жыл бұрын
You sir, are a mad genius!
@ZeroChronicles01
@ZeroChronicles01 4 жыл бұрын
This does work ! how ever! If your ship is aiming like a twin stick shooter, the camera will go crazy. still looking for a fix, ill update my comment if i do find one, but i wanted to let people know
@shavais33
@shavais33 2 жыл бұрын
Awesome tutorial! This is almost exactly what I want.. but not quite. I don't want layers. I want each star to have its own distance and type. I have a GLSL shader program (a combination of a vertex and a fragment shader) that I wrote for an OpenGL C++ program I wrote that creates a starfield like this that moves around based on a camera position, in which each star has it's own x,y position, z-distance, and type. The vertex buffer passed to the shader has an x,y position, a z-distance, and a star type. The fragment shader renders a point sprite that is selected from a small atlas based on the star type. it works great for my purposes, except, well... I haven't learned how to program coded shaders in Unity yet. It's kind of a barrier for me at the moment. =(
@brettsullivan4025
@brettsullivan4025 10 жыл бұрын
why dont you just call it a base mesh instead of a mesh filter?
@GregamoNintendo
@GregamoNintendo 2 жыл бұрын
Amazing video, thank you so much!
@devendergupta_official
@devendergupta_official 8 жыл бұрын
how to make a paragraph scroll up automatically and repeatingly?
@1K1NDR3D
@1K1NDR3D 8 жыл бұрын
paragraph lol
@PixelMake
@PixelMake 6 жыл бұрын
we have some free ships and asteroids and other assets for your games on our channel & tutorials best of luck with your project. if you do decide to use our stuff we would love to see your creations tweet or message us on facebook Instagram . stay awesome!
@Thezaccazzac
@Thezaccazzac 10 жыл бұрын
not to complain, but the download for this file does not seem to work. btw great tutorial really informative and to the point :D
@Thezaccazzac
@Thezaccazzac 10 жыл бұрын
***** yeah still says: ___ Not Found The requested URL /unity_tutorials/Infinite Scrolling&20Tutorial.zip was not found on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. Apache Server at quill18.com Port 80 ___ but this was what the problem was before so it's still broken sadly...
@Thezaccazzac
@Thezaccazzac 10 жыл бұрын
***** hey it worked thanks dude :D
Parallax Infinite Scrolling Background in Unity
17:11
Code Monkey
Рет қаралды 150 М.
choosing a game engine is easy, actually
15:08
samyam
Рет қаралды 615 М.
Mom Hack for Cooking Solo with a Little One! 🍳👶
00:15
5-Minute Crafts HOUSE
Рет қаралды 21 МЛН
Sigma Kid Mistake #funny #sigma
00:17
CRAZY GREAPA
Рет қаралды 27 МЛН
黑天使只对C罗有感觉#short #angel #clown
00:39
Super Beauty team
Рет қаралды 34 МЛН
She made herself an ear of corn from his marmalade candies🌽🌽🌽
00:38
Valja & Maxim Family
Рет қаралды 16 МЛН
Infinite Parallax Scrolling Background - Unity 2D Complete Tutorial
7:24
Game Code Library
Рет қаралды 11 М.
How Two People Created Gaming’s Most Complex Simulation System
38:54
ThatGuyGlen
Рет қаралды 1,5 МЛН
I Wish I Had Known This Before I Started Unity Game Development...
11:11
Unity Tutorial: 2D Space Shooter - Part 1 - Sprite Setup!
22:01
quill18creates
Рет қаралды 191 М.
THIRD PERSON MOVEMENT in Unity
21:05
Brackeys
Рет қаралды 1,5 МЛН
Creating a Spaceship in Blender | Tutorial
7:51
Skill La Noodle
Рет қаралды 57 М.
Unity vs Unreal: Which Engine Should You Choose As A Beginner
14:18
Awesome Tuts - Anyone Can Learn To Make Games
Рет қаралды 995 М.
Mom Hack for Cooking Solo with a Little One! 🍳👶
00:15
5-Minute Crafts HOUSE
Рет қаралды 21 МЛН