Switching BAKED lights during RUNTIME in Unity

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 ธ.ค. 2024

ความคิดเห็น • 42

  • @Massive-3D
    @Massive-3D 8 หลายเดือนก่อน +2

    what an incredible and untapped element of the game dev experience. you have changed my game drastically not only with lighting but I have learned more about manipulating arrays which is something I really need for my inventory

  • @TheBasementDwellers
    @TheBasementDwellers ปีที่แล้ว +9

    Bro, tutorials on stuff as specific as this are so incredibly useful. Thanks a lot for this.

  • @zerin5510
    @zerin5510 ปีที่แล้ว +16

    Bro's voice so hot it actually BAKED me

  • @elepunto.
    @elepunto. ปีที่แล้ว +3

    this helped a lot! thank you!
    btw you have to make sure that the textures are properly ordered in the array (or you'll have the problems I had)

  • @chakravarthyelumalai8408
    @chakravarthyelumalai8408 ปีที่แล้ว

    Love you brother. This is so useful and straight to the point. Thanks a lot.

  • @TheFireNoodle
    @TheFireNoodle 4 หลายเดือนก่อน +4

    I wonder if it's possible to lerp between the different lightmaps? Like a transition effect over time (day - night).

    • @arqazi5632
      @arqazi5632 23 วันที่ผ่านมา

      Yes, we can

  • @duh160
    @duh160 7 หลายเดือนก่อน +1

    Can I use the script in my commercial game project?

  • @coderra4ever
    @coderra4ever 10 หลายเดือนก่อน +1

    Hey! I know you already expplained the UserInputMap error, but i don't really understand how to do it. Do you have any guide or something for it?

  • @inofensivo2001
    @inofensivo2001 ปีที่แล้ว +1

    This is GOOOOOD

  • @ericzwirnmann8151
    @ericzwirnmann8151 8 หลายเดือนก่อน +1

    I was able to build the two sets of light maps for Dark and Light, but I can't get them to switch using the LightSettings.lightmaps = ___ like in the example. The files are in the correct order on the input parameters

  • @plokovr
    @plokovr หลายเดือนก่อน

    Do you know if we can lerp from one lightmap to the other? To have a smooth transition

  • @PR0XYL1NK
    @PR0XYL1NK 10 หลายเดือนก่อน

    how could i put this to a player toggle interact button in game? im a bit lost at the part where they seem to be keyboard bindings.

  • @hambonetunes1988
    @hambonetunes1988 4 หลายเดือนก่อน

    THANK YOU!

  • @Soundy777
    @Soundy777 ปีที่แล้ว

    Brilliant! Subbed! More please!!!

  • @jorgeponce5147
    @jorgeponce5147 10 หลายเดือนก่อน

    Hello! Thank you very much for your help! It helped me a lot. What I'm trying to do now is also change the reflections that were created as a Cubemap, do you have any idea how I could do it?

  • @blinkachu5275
    @blinkachu5275 ปีที่แล้ว +1

    That's really cool
    But
    Would you also be able to do this with only turning off one light at a time? Because right now it turns off all lights, but what if I want to have a feature where a player could shoot out a light for instance without relying on baked lighting?

  • @fernidadeveloper199
    @fernidadeveloper199 11 หลายเดือนก่อน

    good tutorial bro,

  • @MuhammadRafay-gg6gi
    @MuhammadRafay-gg6gi ปีที่แล้ว

    Im getting the following error in your provided script:
    The type or namespace name 'UserInputMap' could not be found (are you missing a using directive or an assembly reference?)
    any solution?

    • @ClickyDev
      @ClickyDev  11 หลายเดือนก่อน

      It's a custom InputMap name generated from InputAction object that you create with Unity's New Input System, check out their docs on how to create InputMap and be sure to have "Generate C# Code" ticked in said asset options (Click on InputActions and select it in Inspector)

  • @MareHazyDawn
    @MareHazyDawn ปีที่แล้ว +1

    The links in the description are broken btw. Neat showcase.

    • @ClickyDev
      @ClickyDev  ปีที่แล้ว

      I am aware, that is/or was because of TH-cam policy that doesn't allow unverified accounts for posting links in the video descriptions. I'll update them as soon as possible when I get verified.

    • @SunnyChaudhary-nf5ec
      @SunnyChaudhary-nf5ec หลายเดือนก่อน

      @@ClickyDev bro you still not verified T_T pls, comment the links. i really need it. REALLY APPRICIATE THE TUTORIAL as well

  • @GameStaplersStudio3
    @GameStaplersStudio3 ปีที่แล้ว

    thanks, subbed

  • @geoffreyhendrikx
    @geoffreyhendrikx ปีที่แล้ว +1

    How heavy is this operation?

    • @ClickyDev
      @ClickyDev  ปีที่แล้ว +1

      It's lighter than using realtime lighting because your GPU doesn't need to recalculate lightmap everytime a light changes. But it has some limits, like for example you have to bake every possible light state if you want to have more than 2 lightmaps. Althought it allows for a better fine-tuned lighting.
      And remember, you can always mix baked and realtime lights

  • @DrumsVSTheWorld
    @DrumsVSTheWorld 7 หลายเดือนก่อน

    is this on URP?

  • @mad_man_86
    @mad_man_86 9 หลายเดือนก่อน

    Hm weird, when I copy the lightmaps into a folder and bake again, the lightmaps disappear from that folder.

    • @ericzwirnmann8151
      @ericzwirnmann8151 8 หลายเดือนก่อน +1

      I ran into this too, had to delete the Lighting Data Asset under Baked Lightmap tab to prevent the previous light map files from getting deleted.

    • @mad_man_86
      @mad_man_86 8 หลายเดือนก่อน

      @@ericzwirnmann8151 Hey thank you for your reply, I will try that :)

    • @ericzwirnmann8151
      @ericzwirnmann8151 8 หลายเดือนก่อน +1

      @@mad_man_86 let me know if you got the transition to work, I’m using unity 2023 and can’t get it to switch back and forth. I was close with switching to a dark mode with baked light and back to a light mode without any baked lights but still wasn’t right.

    • @ManuelBeraha
      @ManuelBeraha 7 หลายเดือนก่อน +1

      @@ericzwirnmann8151 It works, but the way I do it now is keep the lighting data asset in the scene folder and just copy the images (using the windows explorer) into separate folders. Works great now :)

  • @fear-the-phantom
    @fear-the-phantom ปีที่แล้ว

    Would this work with two lights close to each other?

    • @ClickyDev
      @ClickyDev  ปีที่แล้ว +1

      As long as they're baked - then yes. But if you want to disable one of them you have to bake separate lightmap for every possible outcome you want.

    • @fear-the-phantom
      @fear-the-phantom ปีที่แล้ว

      @@ClickyDev So.. If I have 16 lights, I've gotta make 65,536 lightmaps? 😂

  • @mimivrc4148
    @mimivrc4148 ปีที่แล้ว

    how does this work with light probes?

    • @ClickyDev
      @ClickyDev  ปีที่แล้ว +1

      I assume you'd have to modify LightmapSettings.lightProbes
      where you need to assign new LightProbes variable, which has bakedProbes array that contains all of the scene's baked probes that you need to set

    • @S111A111S
      @S111A111S ปีที่แล้ว

      But where are these probe files stored? And how are they assigned?@@ClickyDev

    • @ClickyDev
      @ClickyDev  ปีที่แล้ว

      @@S111A111S They are placed by Unity in the Scene folder that is being created by baking the scene lightning.
      The filename of them is called ReflectionProbe-n.exr, where n represents the reflection probe number I assume.
      I think you should be fine by just dragging that file onto the reflection probe field in the inspector.

  • @JMM57
    @JMM57 ปีที่แล้ว

    does not work for what I need but thanks it's useful info

  • @AkulaAviator
    @AkulaAviator 6 หลายเดือนก่อน

    It doesn't work for me.