3 Ways to make a Scope Zoom Effect (Unity Tutorial)

Поділитися
Вставка
  • Опубліковано 20 сер 2024

КОМЕНТАРІ • 161

  • @CodeMonkeyUnity
    @CodeMonkeyUnity  2 роки тому +3

    🌍 Get my Complete Courses! ✅ unitycodemonkey.com/courses
    🔴 RELATED VIDEOS 🔴
    What are Events? (C# Basics) ua-cam.com/video/OuZrhykVytg/v-deo.html
    Make Awesome Effects with RenderTextures! (Minimap, In-game TV, Camera to Texture) ua-cam.com/video/Ah2862Gz3_s/v-deo.html
    How to make ZOOM Shader Effect! (Unity Tutorial Shader Graph) ua-cam.com/video/IC5JoS0wX0s/v-deo.html
    SMOOTH with LERP! (Move, Rotate, Float) ua-cam.com/video/jAN2IoWdPzM/v-deo.html
    ✅ Get the Project files unitycodemonkey.com/video.php?v=9g2VqJvWnQI

  • @reactga
    @reactga 2 роки тому +49

    Great video 👍 but I believe the third method can be optimized by disabling the camera when not zooming and just rendering black (or red) on the zoom scope.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 роки тому +10

      Yup, if you don't want that bonus effect where you see it working while the rifle is down then disabling the camera will give you a nice boost

    • @mintesnotmelese6552
      @mintesnotmelese6552 2 роки тому +1

      Exactly like in Realm Royale (If you knew this game). And the scope is a little bit smaller, right?

  • @devzozo
    @devzozo 2 роки тому +31

    So there's another way you can do this! You can make a standard glass shader, which there are plenty of guides on making, and using the index of refraction, you can simulate a real telescopic lens! One of the advantages to this is that you get distortion at the edges.

  • @joy211191
    @joy211191 2 роки тому +9

    For the third one, you can add a fish-eye effect on the second camera to get a better effect.

  • @nocturne6320
    @nocturne6320 2 роки тому +34

    I think the best way gameplay-wise is just do it the way most FPS do. That it, just increase the FOV, disable the weapon viewmodel and use UI to simulate the scope. Works like this in TF2, CSGO, Overwatch, etc.

    • @at930pmgames
      @at930pmgames 2 роки тому

      Yup, best way.

    • @jaspervandijk27
      @jaspervandijk27 2 роки тому +8

      @@at930pmgames not the best way but its a way

    • @jzjzjzj
      @jzjzjzj 2 роки тому +1

      yeah but anyone with a brain knows it looks trash and you cant see if some thing is walking near you

    • @nocturne6320
      @nocturne6320 2 роки тому +3

      @@jzjzjzj It is the best way since I am trying to look trough the scope, not around it.
      The ways shown in the video are great as a little visual effect for when the weapon is just being held.
      Actually zooming in is painful when the zoom is only in the center with the rest of the screen remaining unzoomed.
      Think about it as risk and reward, you get better zoom and accuracy for your whole screen, but loose the wide fov for your surroundings, so its easier to sneak up on you.

    • @jaspervandijk27
      @jaspervandijk27 2 роки тому

      @@nocturne6320 Just no haha you are full of bs

  • @DarioDAversa
    @DarioDAversa 2 роки тому +10

    Nice -- I always use the 1st version for just aiming, and the 3rd one for powered zooms.

    • @jamesmillerjo
      @jamesmillerjo 2 роки тому +4

      It perfectly makes sense using method #1 with ironsight.

    • @ezpz4646
      @ezpz4646 2 роки тому +1

      @@jamesmillerjo Or reflex/red dot sights

  • @infinixs4600
    @infinixs4600 2 роки тому +5

    Thanks for this I hope I could support you by Money but I am still a student😂

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 роки тому +3

      Thanks for watching the videos!

    • @GameDevForLife
      @GameDevForLife 2 роки тому +1

      I will start saving money for you to support your Channel and for keeping creating these incredible video

    • @infinixs4600
      @infinixs4600 2 роки тому

      @@GameDevForLife Absolutely He deserve

  • @agnarzb
    @agnarzb 2 роки тому +2

    thanks a lot, amazing tutorial. Maybe zoomcamera can be disabled while player not pressing the zoom button. That could solve the problem of continuous resource allocation.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 роки тому +3

      Yup that would help performance if you didn't want that bonus effect of seeing the scope working while the rifle is down

  • @ivailomanolov6908
    @ivailomanolov6908 2 роки тому +2

    WOW ! Love it , it was very fun to watch this video. Nice job

  • @stephenmackenzie9016
    @stephenmackenzie9016 2 роки тому +1

    Nice 👍🏻

  • @diliupg
    @diliupg 2 роки тому +1

    Nice Tute! You are very hard working and very smart. Thanks!

  • @jihadrouani5525
    @jihadrouani5525 2 роки тому +1

    3rd Method downside: This might be late but there's a huge downside to the 3rd method, in low light environments (Night time) the lens (quad) won't show up because it needs to be lit, it's only visible when you pass near a light and acts as an opaque material because it is.
    Potential fix: Make the material unlit, but it'll look weird and way to bright "relative to the night environment", so might need a script to turn down the brightness when you're not scooped. You could use this opportunity to switch the render texture to a low res one to save performance.

    • @chibidoragon
      @chibidoragon Рік тому

      Attach a script to the scope camera that uses Unitys OnPreRender() call to set ambient light a bit higher and then setting it back on OnPostRender(). Or if you have night vision scope set ambient light to bright green OnPreRender().

  • @adamodimattia
    @adamodimattia 2 роки тому +1

    Great content as always!

  • @swanoftheeast
    @swanoftheeast Рік тому

    Great Video, thanx. Helped me a lot to understand basic priciples.

  • @4xh9
    @4xh9 21 день тому

    First Methode Very Good u Can a get Blure Texture For environment with Scope Texture and Hidle all Make the Textures in Ui And u Have it !

  • @vacantknight
    @vacantknight 2 роки тому +2

    Could you do a tutorial on how to make a gun like your Hookshot but you can swing from the hook so you can like run jump shoot the hook and swing from a object and land

  • @jesse143_
    @jesse143_ 2 роки тому +2

    Can you make a video on mesh deformation? This would be great for tank tracks

  • @nikodromikro
    @nikodromikro Рік тому

    Thanks

  • @akstis4183
    @akstis4183 2 роки тому +3

    Is that a magic? I'am currently thinking about scopes implementation :D But anyway thanks for the video. They are very helpfull

  • @KalponicGames
    @KalponicGames 2 роки тому +2

    are you planning to make a full 3rd person shooter game or something? Would love to see some melee 3D combat too :)

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 роки тому +2

      Heh not really planning something that big, just exploring lots of topics. 3D Melee is also something I'd like to research, just need to find the time

  • @PoddStudios
    @PoddStudios Рік тому

    Here's a tip if your using the 3rd option and to lazy to mask the plane just use a cylinder and shrink it. It just WORKS

  • @Darmsofficial
    @Darmsofficial Місяць тому

    I don't know how does reticle works in scopes.. is there any video tutorial on how this thing works??

  • @abhisheksuper20
    @abhisheksuper20 2 роки тому

    simply amazing!!

  • @iorusoul
    @iorusoul 2 роки тому +5

    RenderTexture works fine even in a ps vita wich has a really small arm processor, I guess the complexity of the scenario adds up for potencial problems. I Usually show the render as a part of UI is that less effiecient?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 роки тому +2

      You could definitely show it in the UI instead but if you do then it wouldn't look good combined with the rifle up animation. If there's no animation then yup it would look perfect

  • @pedramkavian
    @pedramkavian 2 роки тому +2

    Most of the games usually show only the weapon's scope when players press the mouse right button.
    What about adding some kind of Shader/Post Processing/etc. to the first way to just make the whole screen black but showing only the scope?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 роки тому +4

      Sure you could improve the first method by hiding the rest of the screen, could be as simple as a texture with a hole in the middle or a cutout shader

  • @stuart5980
    @stuart5980 2 роки тому +3

    Could you make a tutorial on how to make a save load system with bolt? I know bolt has save variables but i'm yet to find any tutorial on how to put that to use

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 роки тому

      You can combine it with JSON to save lots of data in a string
      ua-cam.com/video/4oRVMCRCvN0/v-deo.html
      ua-cam.com/video/6uMFEM-napE/v-deo.html

    • @FelineRaptor-gv4te
      @FelineRaptor-gv4te 2 роки тому

      @@CodeMonkeyUnity but JSON or XML is not very secure. using binary formating would be better

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 роки тому +1

      @@FelineRaptor-gv4te It's not intended to be secure, binary formatting by itself is also not secure. Saving Data and Securing that data are two completely separate topics. You can do one without the other or both

    • @FelineRaptor-gv4te
      @FelineRaptor-gv4te 2 роки тому

      @@CodeMonkeyUnity oh. actually i had seen Brackeys tutorial on Save and Load System and there he had said binary formatting was more secure than JSON and XML as these files can be modified easily which is not the case for binary formatter since it is written in binary. but yeah, securing data is a completly different topic, so never mind. was just a suggestion. thanks for replying anyway. means a lot coming from a famous youtuber

  • @Huyuimu
    @Huyuimu 2 роки тому

    i just love this guy

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 роки тому +1

      Im glad you like the videos! Thanks!

    • @Huyuimu
      @Huyuimu 2 роки тому

      @@CodeMonkeyUnity Always!

  • @SondaPower
    @SondaPower Рік тому

    I have a problem in URP and Standard Render as well... if I zoom in at some angles the scope becomes too bright or too dark. I can't find the solution only something about the shader but it didn't work.

  • @jamesmillerjo
    @jamesmillerjo 2 роки тому

    Bravo

  • @watercat1248
    @watercat1248 3 місяці тому

    With sniper's for my game I will probably have the first 1
    But with the with gian image that caver the wail screen like old game's. such as counter screen.
    Not 3D models but I'm sure I will use the second effect in some port's off my game.
    Also I'm not sure what what type of zoom I will use for weapons that have the option to aiming down site.

  • @MarekNijaki
    @MarekNijaki 2 роки тому

    Awesome!

  • @aminthemar
    @aminthemar 2 роки тому +2

    I disagree that the 3rd one is the best of them since a real-life scope zooms your entire vision which is the 1st one.
    But if you were to create a magnifying glass for your game, the 3rd one is surely the best.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 роки тому +1

      What? How does a real life scope zoom outside of the scope?

    • @aminthemar
      @aminthemar 2 роки тому

      @@CodeMonkeyUnity In real life, you'd hold the scope up to your face and look into it with one eye and close the other which means you never see outside the scope.
      Here, you are holding it far away from yourself like a magnifier hoping to kill people with it 🤣.

    • @Junaidy-hk8ff
      @Junaidy-hk8ff 2 роки тому

      @@aminthemar no, i think the 3rd one without shader and camera post processing is the closest one to real-life scope

  • @ShortBarrelRaifu
    @ShortBarrelRaifu 2 роки тому

    IMO, use 2nd method for low magnification mode, and 3rd method whenever the scope enter medium-high magnification mode ... and also need to figure out how to integrate those two seamlessly into just one ScopeSystem

  • @pikkigaming2024
    @pikkigaming2024 2 роки тому

    great vid thanks please keep making videos of like this

  • @johnbeverly9723
    @johnbeverly9723 2 роки тому

    What about combining methods 1 and 2

  • @yudipscodeshow
    @yudipscodeshow 2 роки тому +1

    Excited for squid game 🤞🏻🤞🏻😄😄😄

  • @huguesdepayens9558
    @huguesdepayens9558 Рік тому +1

    With the first method, is there a way to blur the area outside of the scope?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  Рік тому

      Only way would be with some kind of mask texture to blur the area outside the scope. Easy if all your scopes have the same shape, more difficult if they're different unitycodemonkey.com/video.php?v=dKsqupXLuSU

  • @Saskamon
    @Saskamon 2 роки тому

    thanks a lot!

  • @activoysaludable
    @activoysaludable 2 роки тому

    Buen vídeo amigo 😃

  • @tone.c.a.e
    @tone.c.a.e 2 роки тому

    i wish all fps games have scope zoom effect 1, i love games like that im sad that batttlefields dont have it, but 2042

  • @zakvaska666
    @zakvaska666 2 роки тому

    Awesome =)

  • @thg1nrediar
    @thg1nrediar 2 роки тому

    Good

  • @arcday4281
    @arcday4281 2 роки тому

    Cool!

  • @alaa0khallouf
    @alaa0khallouf 2 роки тому +1

    would love to see your opinion on making scopes for vr.
    now the third option definitely works in vr but what are your other options for making vr scopes especially if it's for mobile vr which is very hard to optimize

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 роки тому +1

      Depends on how resource intensive is the rest of your game. If you need maximum performance then the first method would be the best or lower the RenderTexture resolution on the third method

  • @blitzo8753
    @blitzo8753 2 роки тому

    Hi CodeMonkey have you made a video about arranging or sorting scenes assets, files of full games?

  • @guidetogamedev3657
    @guidetogamedev3657 2 роки тому

    hey can you cover MLAPI and make a tutorial on how to make a fps with it

  • @PRodi_
    @PRodi_ 2 роки тому +2

    Is there a way in to improve quality of the second method?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 роки тому +2

      Not really, the shader just zooms in on the already rendered image, it cannot create extra resolution.
      You could try increasing the global render scale to make the whole game render more but at that point it's much better to use the last approach

    • @PRodi_
      @PRodi_ 2 роки тому +2

      @@CodeMonkeyUnity Good to know thx :)

  • @ahmadgamal65
    @ahmadgamal65 2 роки тому

    The best method is to use stencil mask to render what's behind the scope glass and use shader for the reticle and the scope lens affect and zoom using the first method

    • @iahmed1400
      @iahmed1400 2 роки тому +1

      i am doing exactly that. But with the 2nd zoom shader. But the problem I m facing rn is that, I cant see any transparent object through the zoom shader. Everything else works fine.

    • @ahmadgamal65
      @ahmadgamal65 2 роки тому +1

      @@iahmed1400 but I have never seen such a problem

    • @iahmed1400
      @iahmed1400 2 роки тому

      @@ahmadgamal65 i fixed it about an hour after posting the comment lol.

    • @ahmadgamal65
      @ahmadgamal65 2 роки тому

      @@iahmed1400 I posted a solution but I don't know why the duck 🦆 it's not here

  • @dotmbarricade3424
    @dotmbarricade3424 2 роки тому

    Can you make a turotial on how to apply stun affect on characters?

  • @A5tr0101
    @A5tr0101 Рік тому

    Hey, do you have a video of correcting the barrel spawn to where the scope faces? My idea was to change the bullet spawn position but im unsure how to make it look good

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  Рік тому

      Best option is simply do a raycast to find the position in front of the scope, then spawn a bullet from the barrel and move to that point instead of straight forward, I did something like that in my Third Person Shooter unitycodemonkey.com/video.php?v=FbM4CkqtOuA

    • @A5tr0101
      @A5tr0101 Рік тому

      Thanks dude, i did just that and it works perfectly

    • @A5tr0101
      @A5tr0101 Рік тому

      I ended up spawning the bullet, lerping it up to the scope alignment then firing forward, in games like battlebit i noticed the tracer isn't visible for 10 feet or so so maybe they do something similar with it

  • @LaughingMan44
    @LaughingMan44 2 роки тому

    IRL, you wouldn't be able to see through the scope unless your eye is directly behind it and the correct distance away (not too close or too far), and would just appear black or you'd only see a % through the scope. Games like Escape From Tarkov do it, but I'm not sure how? I guess it's a shader of some kind?

    • @mudokin
      @mudokin 2 роки тому +1

      I think it's a dynamic alpha shader, that changes according to the angle of the rifles scope.

    • @diliupg
      @diliupg 2 роки тому

      @@mudokin nope! You can do it very easily by having the gunscope ( a black image with a hole in the center with the crosshair) on the UI and while zooming in towards the gun using a cinemachine camera, you can activate the UI crosshair image and see only thru the scope while keeping the surrounding black.

    • @LaughingMan44
      @LaughingMan44 2 роки тому

      @@mudokin Cool thanks

    • @LaughingMan44
      @LaughingMan44 2 роки тому

      @@diliupg That's not what I was talking about

    • @OlehBilov
      @OlehBilov 2 роки тому

      Yeah, there must be a shader. I've found red dot shader and modified it a little bit so instead of a dot it was rendering a black image with transparent alpha hole in the center. But I couldn't get rid of some graphics artifacts

  • @bigphizzle9493
    @bigphizzle9493 2 роки тому

    Can you use the third method for a VR game on the oculus quest 2 or will it be too demanding for the hardware?

  • @Anders2057
    @Anders2057 2 роки тому

    7:52
    hola.
    mi shader es rosa.
    sabes que podria ser? 7:52

  • @zanmeong6289
    @zanmeong6289 2 роки тому +1

    Is i7 gen 4 8gb ram and gt740m is enough for developing 2d or simple 3d game on unity?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 роки тому +1

      It all depends on how big is the game, just download and try it

    • @calzar2009
      @calzar2009 Місяць тому

      yes i have around the same specs and i have been making games for 4 years

  • @runnair
    @runnair Рік тому

    Hi! Thank you for the great tutorial, I am using the third method. I've got one question. If I throw a smokebomb it will emit partiles over time (texture sheet material) and when I use the scope the particles spread out if I'm inspecting the smoke (because of different FOV). Is there a way to display the smoke and zoom into it at the same time without it being spreaded?
    PS: I know it's possible to simulate smoke in other softwares and then put it on a non scaling plane, but I'd like to do it with built-in particles, even in standard render pipeline.

  • @MASTONGAMES
    @MASTONGAMES 2 роки тому

    lack of blur area outside the crosshairs (peripheral vision)

  • @ekekw930
    @ekekw930 5 місяців тому +1

    At 9:40 how do I add that depth of field effect only to that camera?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  5 місяців тому +1

      You can define the Volume layers on the camera. So you can have one volume with DoF and one without, and make the cameras that you want to have DoF include that volume in their layers

    • @ekekw930
      @ekekw930 5 місяців тому

      @@CodeMonkeyUnity I cannot seem to get it to work. I have one MainCamera, with my sniper model under it, and in my sniper model I have my AimCamera. I have two different post processing volumes; one global and one with DoF. Both are enabled, and the DoF field I have put on the Layer "Lens". In the MainCamera I have added Defualt and Lens layers to the Volume Mask and now the DoF takes effect but also on the AimCamera. How do I exclude this one?

    • @ekekw930
      @ekekw930 5 місяців тому

      I have also tried removing "Lens" from the AimCamera culling mask but without any luck

    • @ekekw930
      @ekekw930 5 місяців тому

      @@CodeMonkeyUnity Its only blurring when aiming, when moving around the image looks clear in the scope

  • @MarushiaDark316
    @MarushiaDark316 2 роки тому +1

    When do we get to see your Squid Game sim?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 роки тому +1

      Tomorrow! ua-cam.com/video/D_2bGpMeV4U/v-deo.html

  • @discoman4118
    @discoman4118 Рік тому

    Is it possible to use 1 render texture and material for 10 snipers, or would I have to create a seperate render texture and material

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  Рік тому

      As long as you only use one sniper at a time then yes they can all share the same. Just keep the other cameras disabled and only enable the one you're using

  • @salimnihat6966
    @salimnihat6966 2 роки тому

    Great Video !!! Can I ask for a Video about 2D Joints ? ^_^

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 роки тому

      That is something I'd like to research at some point, there's lots of interesting physics joints but I haven't used them much

  • @victorcamacho6253
    @victorcamacho6253 2 роки тому

    i did something similar to 3rd method some years ago, more recent a had troubles to get a good solution to simulate a red dot, do you know some shader to can replicate the functionality of a red dot or holographic sights?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 роки тому

      I'm not sure what is the specific effect for a holo sight, is it just staying a bit behind when the player moves? If your renderer has motion vectors you could probably use that, or just some simple code logic based on the mouse input

  • @cate01a
    @cate01a 2 роки тому

    Damn, I wonder if there's better options for vr? 1 is N/A, 2 works but is not great coz pixels (pavlovs solution), and 3 is cool but probably wouldnt work if you looked at the scope at angles, also would probably be buggy if the gun clipped through the ground

    • @thepolandman2447
      @thepolandman2447 2 роки тому +2

      You could probably change the rotation of the zoom camera depending on the angle the player is looking into the scope. If the angle is too big (e.g. looking at the scope from almost the side) turn off the render texture.

    • @cate01a
      @cate01a 2 роки тому

      @@thepolandman2447 oh yeah that might be a solution!

  • @vrajmodi8122
    @vrajmodi8122 2 роки тому

    how to use post processing and Depth of field?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 роки тому +1

      You add the Volume component and enable Post Processing on the camera
      This video covers the steps to add Bloom which is a PP Effect ua-cam.com/video/bkPe1hxOmbI/v-deo.html

  • @kris.tamang
    @kris.tamang 2 роки тому

    3:18
    only scope zoomed in will be better and realistic, I guess !!

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 роки тому

      You could disable the zoom camera while the rifle was down if you didn't want that bonus effect

  • @TigerMax96
    @TigerMax96 2 роки тому +1

    Second solution doesn't work in URP?
    Renders plain white material.
    Thanks for your tutorial!

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 роки тому +2

      I am using URP in the video, watch the dedicated video on the zoom shader ua-cam.com/video/IC5JoS0wX0s/v-deo.html

  • @OmuniReborn
    @OmuniReborn 2 роки тому

    Bro, We love your work and appreciate it a lot but... WHY LIGHT MODE?! lol

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 роки тому +1

      Because dark mode burns my eyes, I can't look at it for more than 10 seconds

    • @OmuniReborn
      @OmuniReborn 2 роки тому

      @@CodeMonkeyUnity Thanks for the reply ^^ Was totally kidding of course but I'm actually shocked that that's the case :o sorry to hear!

  • @iahmed1400
    @iahmed1400 2 роки тому

    I tried the shader method. It worked fine, but when i aim, i can see the inside of the body of the scope because my 3d model is hollow. Is there a way I can keep the sphere with zoom shader at the front of the scope and render its output to another one that is at the rear / closer to the camera?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 роки тому +1

      Nope, that method just expands the pixels exactly as they are. Maybe you could try something really complex playing around with the render tags queue but for your case using hte third method seems best.

  • @adhochero6619
    @adhochero6619 2 роки тому

    was hoping this would've been a bit more advanced and make it look like looking through a real scope. all these option just look like the scope is digital and not optical

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 роки тому

      What do you mean by that? How would you make it look "optical" ? Add some lens distortion on the side? You could do that on the shader that is rendering the render texture

    • @adhochero6619
      @adhochero6619 2 роки тому

      @@CodeMonkeyUnity yeah something like that also if your not looking at it strait on have the black edges from the scope. idk don't to describe it but it was solve the unrealistic issue of seeing through the scope while its down by your side.
      great video though. just was hoping one of the options went into to how to really make a realistic scope as its hard to find much more than the basic ways

  • @juice1884
    @juice1884 2 роки тому

    Why would you ever use normal C# events using Unity? I find the serializable nature of UnityEvents so helpful during game design, as I can change the game in seconds without changing code at all. Even in this case, what if the user wanted to add a sound when the rifle goes up? They'd have to add extra code.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 роки тому +1

      Yup that's exactly the difference.
      Do you prefer working mainly in the Editor? Use UnityEvents.
      Do you prefer working mainly in code? Use C# Events.
      Personally I like to keep my games as much in the code as possible so for me I prefer C# events.

    • @juice1884
      @juice1884 2 роки тому +1

      @@CodeMonkeyUnity Gotcha!

  • @infinixs4600
    @infinixs4600 2 роки тому

    First one to see this video

  • @charliekendall7511
    @charliekendall7511 2 роки тому

    Could the second camera be improved by moving the zoom shader effect to the end of the sight, so the cross isn't magnified?

    • @s4shrish
      @s4shrish 2 роки тому

      Fundamentally, it will always be a little pixelated, as it's essentailly a screen-space effect. Meaning, it essentially takes the scene_render.jpeg, cuts it to seperate layer, zooms in, and pastes it on the scope object. You can move it whereever, a 4X Zoom will lead to a 4X reduction in Pixel Density. Or like we say in terms of Phone cameras, it's Digital Zoom, not optical Zoom.
      Tho I would like to say one thing, if we consider the third method's Scope's area on the screen, it doesn't really take more than 50% of the vertical height. So for a 1080p image, that would be 540p. Or even 512x512. 1000x1000 seems small when you compare it to actual screen res, but when you actually look at how much area it occupies at most, the max res it will need on a 1080p monitor is 512x512. And if one optimises it acc to game's resolution settings, we can save more performance whilst keeping the scope only as pixelated as the rest of the game.

    • @mudokin
      @mudokin 2 роки тому +1

      yes and no, the cross would not be zoomed, the rest would still be pixelated.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 роки тому +1

      For the cross, you can make it use a shader that renders after the zoom shader, put in on Queue Transparent + 100 and it should be unzoomed

  • @crazyfox55
    @crazyfox55 2 роки тому

    In the second method both the scope and the crosshair are pixelated. Is there anyway to get the crosshair to stay small?

    • @diliupg
      @diliupg 2 роки тому

      yes.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 роки тому

      You can make the cross use a shader that renders after the zoom shader, put in on Queue Transparent + 100 and it should be unzoomed

  • @Inf4mousKidGames
    @Inf4mousKidGames Рік тому

    So... Zoom levels are just hard coded FOVs?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  Рік тому

      You can put that data anywhere you want, doesn't have to be directly in the code, you could make a ScriptableObject for each Scope and store the fov there

    • @Inf4mousKidGames
      @Inf4mousKidGames Рік тому

      @@CodeMonkeyUnity oh I understand that but the one thing I've been looking for, for an fps game I wanted to make was zoom levels for scopes. Like what are the values to mimic zoom levels such as
      1.4x
      2x
      3x
      5x
      6x
      10x
      And I never got an answer.
      This video you've made is the closest I've gotten to an answer

  • @Junaidy-hk8ff
    @Junaidy-hk8ff 2 роки тому

    hey codemonkey, how about 3d person camera scope ?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 роки тому

      Usually in third person games it either only uses the first method, changing the FoV, or it swaps into a full screen view of the scope

  • @absolutesolver-ur5hb
    @absolutesolver-ur5hb 2 роки тому

    how to make elevator when press button to move up or down??

    • @diliupg
      @diliupg 2 роки тому +2

      use transform translate on the elevator object and a C# Action event to send a message for the translation to happen.

    • @absolutesolver-ur5hb
      @absolutesolver-ur5hb 2 роки тому

      @@diliupg thank very cool

  • @impheris
    @impheris 2 роки тому

    bookmarked

  • @burhanahmad3140
    @burhanahmad3140 Рік тому

  • @ferdiandestrinata9573
    @ferdiandestrinata9573 2 роки тому

    Codemonkeyy i need ur help

  • @tunnatio9751
    @tunnatio9751 18 днів тому

    BRUH CANT DOWNLOAD IT FAKE

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  15 днів тому

      What do you mean? There's a download link in the description