How to make AWESOME Scene Transitions in Unity!

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

КОМЕНТАРІ • 779

  • @Dexigon
    @Dexigon 4 роки тому +965

    I swear, every time I need to add something to my Unity game, you make a video about it on the same exact day.

    • @RedNeckJewsus
      @RedNeckJewsus 4 роки тому +5

      same

    • @GymCritical
      @GymCritical 4 роки тому +4

      Same, I was just stressing on it.

    • @_Vesper
      @_Vesper 4 роки тому +3

      Me too!

    • @Nox__
      @Nox__ 4 роки тому +1

      Me too it always happend

    • @danielwalter5436
      @danielwalter5436 4 роки тому +4

      Look for a @Brackeys package in your package manager. Now you know why.

  • @just.tiramisu
    @just.tiramisu 4 роки тому +1292

    I am so happy your channel exists, i wouldn’t even be able to use unity without your channel

  • @RugbugRedfern
    @RugbugRedfern 4 роки тому +33

    Just saying, it's not a really good idea to animate UI elements. If an animator is on a UI element, even if it's not animating, it will update all of the attached UI every frame. It's pretty bad for performance, especially if you have a lot of UI elements on your canvas. Tweening is a better way to do it, and popular ones like DOTween and LeanTween do the same job very well at a much lower cost.

    • @Anqct
      @Anqct 2 місяці тому +1

      How about manipulating opacity on images?

    • @LeHieu-sr2kn
      @LeHieu-sr2kn 2 місяці тому +2

      But tween has its cons that not every effect can be "DO" without paying for the pro version. And even when you buy the pro version, there are still effects that it can't do😮

  • @Oxygeniium
    @Oxygeniium 4 роки тому +458

    6:11 instead of creating a new animation, you can put the same animation 2 times to the Animator Controller and in the second animation set "Speed" to "-1" in the inspector :).

    • @supendi42
      @supendi42 4 роки тому +24

      Nice tips brother

    • @sagiziv927
      @sagiziv927 4 роки тому +19

      Thought about it too, but creating 2 animations is easier to understand, and in this case, swap with different animations

    • @Brackeys
      @Brackeys  4 роки тому +239

      That is definitely true! But for many animations you want the start and end to be different, not just inverted. Such is the case with the CircleWipe for example :)

    • @UnitCodesChannel
      @UnitCodesChannel 4 роки тому +8

      @@Brackeys true

    • @Oxygeniium
      @Oxygeniium 4 роки тому +18

      Yea, I posted this comment for people who don't know about this "trick" and who just want to reverse their animations ;).

  • @MrNerd-ll9my
    @MrNerd-ll9my 4 роки тому +156

    Just a reminder that you're literally the reason that a huge amount of game designers are able to do what they love.

  • @PepsiFruit
    @PepsiFruit 4 роки тому +341

    "the first thing we are going to do" 2:11
    "now we are ready to animate" 4:36
    "let's go ahead and create a level loader script" 9:20
    "All of the code we are going to need" 13:48

    • @UnitCodesChannel
      @UnitCodesChannel 4 роки тому +4

      PepsiFruit commenting so its more visible

    • @riqb837
      @riqb837 4 роки тому +3

      Obrigado!🇧🇷

    • @josepgc1183
      @josepgc1183 4 роки тому +17

      I dunno man having a comment like this is a bit insulting when the video isnt even that long and you can skip around on your own

    • @mannou38
      @mannou38 4 роки тому +33

      @@josepgc1183 let's say, you tried doing this on your own, but came across an error while coding.
      do you really think, everyone wants to spend 13 minutes just to get one single error fixed, when you could've fixed it in less than 3 minutes.
      Timestamps are not "insulting", they are just for people that want to speed up the process.
      Edit: I could go way in depth, but I just don't want to waste my time on someone that is serious about timestamps insulting the creator, I'll just skip to the end💀

    • @RetroAnt3
      @RetroAnt3 4 роки тому +3

      @@mannou38 outplayed

  • @zetsufir
    @zetsufir 4 роки тому +48

    Ps: using the animator on a UI canvas "dirties" it even if nothing is going on because of the transform of the UI elements are being changed by the animator per frame; causing a recompute of all another elements in the same canvas which gets hairy in complex hierarchies. A good practice to improve performance is to make your scene transition in another canvas rather than the one in your UI and toggle on/off when needed.

    • @OlivierPons
      @OlivierPons 3 роки тому +1

      When you disable a canvas, everything instant disappear.... and my solution is the opposite of yours (if your transition is in a second canvas (= you already had one), be careful to put your transition into your first canvas otherwise it wont work (Unity v2021.1.7)) but you are probably right: just showing a basic menu will eat up all the phone's battery... I have no simple solution for this. Maybe insert the "transition canvas" in CSharp when you want to fade out?

  • @n8dev
    @n8dev 3 роки тому +13

    BRUH I HAVE BEEN CHANGING THE ALPHA OF EACH UI ELEMENT HOW DID I NOT KNOW THE CANVAS GROUP EXISTED KFDLJSFLKDSJ:FKDLS:JFD

  • @salad6975
    @salad6975 2 роки тому +21

    All the code for the basic fade in and out
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.SceneManagement;
    public class LevelLoader : MonoBehaviour
    {
    public Animator transition;
    public float transitionTime = 1f;
    // Update is called once per frame
    void Update()
    {
    if(Input.GetMouseButtonDown(0))
    {
    LoadNextLevel();
    }
    }
    public void LoadNextLevel()
    {
    StartCoroutine(LoadLevel(SceneManager.GetActiveScene().buildIndex + 1));
    }

    IEnumerator LoadLevel(int LevelIndex)
    {
    transition.SetTrigger("Start");
    yield return new WaitForSeconds(transitionTime);
    SceneManager.LoadScene(LevelIndex);
    }
    }

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

      @@Malpiszon_JWPit’s not much just honest work

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

      idk why but i wrote all the exact same code and it was showing some errors in unity but when i copied and pasted ur code it worked! u sir are a magic man

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

      Keep in mind that this code does a lot more than just a basic fade, like loading levels in order by build index on mouse click.

  • @alejolab
    @alejolab 4 роки тому +23

    I accidentally found a way to make cool transitions (for a cancelled game long ago).
    Create a bunch of angled boxes with a flat black material covering the whole view of the camera, then animate the near clip plane and that's it.
    (if you need to have objects near the camera in your game use a second camera to render only the transition)
    The first transition I created was a bunch of regular boxes 45º to the camera, it looked like a lot of small triangles growing on the screen until filling it completely. Then I moved some rows a bit closer so the some small triangles would appear first creating in a swiping effect.
    After playing a lot with the concept I ended up creating a custom model in Blender to have a very cool looking transition with shapes swiping and growing from different angles. The possibilities are endless and they are very fast to create.

  • @TurboAlligator
    @TurboAlligator 4 роки тому +6

    For some reason my animation plays, and then the scene doesn't transition. any help would be nice. thanks! (unity version and code --> ) 2019.2.2f1, using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.SceneManagement;
    public class LevelLoader : MonoBehaviour
    {
    public Animator transition;
    // Update is called once per frame
    void Update()
    {
    if (Input.GetKeyDown(KeyCode.G))
    {
    LoadNextLevel();
    }
    }
    void LoadNextLevel()
    {
    StartCoroutine(LoadLevel(SceneManager.GetActiveScene().buildIndex + 1));
    }
    IEnumerator LoadLevel(int levelIndex)
    {
    //play animation
    transition.SetTrigger("Start");
    //wait for it to stop
    yield return new WaitForSeconds(1f); //pauses coroutine for 1 second
    }
    }

    • @GBrayJ
      @GBrayJ 4 роки тому +3

      Try This:
      using UnityEngine;
      using UnityEngine.SceneManagement;
      using System.Collections.Generic;
      using System.Collections;
      public class Start : MonoBehaviour
      {
      public Animator transition;
      // Update is called once per frame
      void Update()
      {
      if (Input.GetKeyDown(KeyCode.G))
      {
      LoadNextLevel();
      }
      }
      void LoadNextLevel()
      {
      StartCoroutine(LoadLevel(SceneManager.GetActiveScene().buildIndex + 1));
      }
      IEnumerator LoadLevel(int levelIndex)
      {
      //play animation
      transition.SetTrigger("Start");
      //wait for it to stop
      yield return new WaitForSeconds(1f); //pauses coroutine for 1 second
      SceneManager.LoadScene(levelIndex);
      }
      }
      You are just missing the SceneManager.LoadScene(levelIndex);

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

      Anonymous Crab it works thanks! I can’t believe I was so dumb

    • @Crystallizedddd
      @Crystallizedddd 2 місяці тому

      @@TurboAlligator turbo i goeilla tag to

  • @visintel
    @visintel 4 роки тому +51

    That canvas group trick for changing alpha is sick!

  • @taylorm2133
    @taylorm2133 Рік тому +19

    Man it's such a shame he doesn't make videos anymore, hands down the best unity tutorials i've found on youtube

  • @OlivierPons
    @OlivierPons 3 роки тому +18

    Hint that worked for me: if your transition is in a *second* canvas (= you already had one), be careful to put your transition *into* your first canvas otherwise it wont work (Unity v2021.1.7)

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

      Bro you are a life saver. I was like what the hell am I doing wrong lol. Can confirm this was my problem and you solved it. Thanks!

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

      Also, if you're like me and have two canvas and have issues with them overlapping each other, *remember to modify their sort order in the inspector*

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

      @@kartman146 so uh what do i need to do? i have 2 canvas as well and the transition doesnt work well in my project....i alr sort the order but it still doesnt work

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

      what do you mean by putting the transtition? what part do i need to move?

    • @MrSacralidge
      @MrSacralidge 11 місяців тому +1

      two years later, still saving the day. thank you!

  • @polrogi
    @polrogi 4 роки тому +79

    we will miss you brackeys :(

    • @BMSThomas
      @BMSThomas 4 роки тому +1

      Feels weird coming back here knowing there probably wont be another video released here for a long time at least

    • @jasondegoumois3809
      @jasondegoumois3809 3 роки тому +1

      R.I.P Brackeys December 2012 - September 2020 He had a good 8 Years... D;

    • @jasondegoumois3809
      @jasondegoumois3809 3 роки тому +1

      I know I'm not dumb lol it just feels like it :T

  • @jessatlife
    @jessatlife 3 роки тому +7

    Anybody following the exact same steps with a later version of Unity, and experiencing a problem where the transition seems to skip the "fade to black" / start animation, and goes straight to the end animation? I've reviewed the tutorial three times now and I can't figure out what's wrong. Alone, the animations seem to work fine (and no looping) when I preview them in the Animation window or in the controller, but even after unchecking hasExitTime and setting transition duration to zero, this is still not working. Looks like there's a problem with SetTrigger or the animation itself.

    • @PeterJohnson76
      @PeterJohnson76 3 роки тому +1

      At the point of my game needing to change levels, my scene is quickly and only partially fading out/in, waiting, then doing scene change. For some reason it's not scene changing during the fade out/in...

    • @Boop_r
      @Boop_r 3 роки тому

      my issue is the same exact thing

  • @danman6538
    @danman6538 4 роки тому +18

    WHY ARE YOU DOING AWESOME TUTORIALS JUST RIGHT AFTER I FINISH MY PROJECT ! WHYYY !!!!
    You're awesome x)

    • @exhamza4063
      @exhamza4063 3 роки тому

      dan man ? is that u GOOD game !

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

    I had a lot of troubles, problems, and errors in the app, so, *I'm sad*

  • @uhkihku6498
    @uhkihku6498 4 роки тому +180

    I wish they were someone like you on Unreal Engine 4

    • @vinos1629
      @vinos1629 4 роки тому +30

      Unreal bad , Godot and unity good

    • @mustafaaljanabi4818
      @mustafaaljanabi4818 4 роки тому +8

      @@uhkihku6498 lol, unreal it,
      *STILL GOOD*

    • @d.l.7416
      @d.l.7416 4 роки тому +9

      u traitor

    • @mustafaaljanabi4818
      @mustafaaljanabi4818 4 роки тому +3

      @@d.l.7416 mInEcrAFt

    • @clamum
      @clamum 4 роки тому +4

      I wanna check out Unreal. I had a job interview last week and the couple guys that did my interview were pretty praising of it (and they had come from Unity, so it's not like they didn't know anything about Unity).
      Just made me wanna at least check it out at some point. They also said there's a free version of it too which I didn't know.

  • @aaronperron
    @aaronperron 4 роки тому +13

    this guy is like the nicest drill sergeant. Plowing through the tutorial with no mercy in the most efficient way.

  • @MinhocaMortifera
    @MinhocaMortifera 4 роки тому +20

    11:16 In my case I used a animation event in the last frame of the animation, but is good know other way of time control! 😁

    • @Brackeys
      @Brackeys  4 роки тому +6

      That is also a good way to do it! :) Just need to make sure that the script is on the same object as the animator!

    • @leozhang1340
      @leozhang1340 4 роки тому +1

      @@Brackeys Hello sir! My team is struggling with making a viewing frustum for the AI in a top down 2d game. Could you please make a tutorial on that? I see a lot of complicated math involved and would love to see it being broken down and made easier. Your other top down tutorials were excellent! Please consider making this one if you can. Thank you!

  • @ralphofficial7794
    @ralphofficial7794 4 роки тому +1

    Hi @Brackeys ! You know this tutorial is good and all but it doesnt works in a main menu screen. Pls help. SOS

  • @blacklight8932
    @blacklight8932 3 роки тому +3

    When I load the second scene and then go back to my first scene, the screen stays black. pls help

  • @thesamepathover6874
    @thesamepathover6874 4 роки тому +32

    It’s insane how I spent all day today figuring out all of this in my own ( animation and coroutines) and then when I go to bed I find this video. 😂😂

    • @kas-lw7xz
      @kas-lw7xz 4 роки тому +3

      @@AhmadRaza-ge3mc matey don't do permanent loops

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

      @@kas-lw7xz HE WAS THE CHOSEN ONE! HE WAS SUPPOSED TO DESTROY THE SITH NOT BECOME ONE!

    • @Hotbotch
      @Hotbotch 4 роки тому +1

      @@kas-lw7xz HE WAS THE CHOSEN ONE! HE WAS SUPPOSED TO DESTROY THE SITH NOT BECOME ONE!

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

      @@AhmadRaza-ge3mc But this code will run the fading animation with different speed on different computers because of CPU clock frequency, and using animations you can set the exact amount of time.

    • @kelpdock8913
      @kelpdock8913 3 роки тому

      @@Hotbotch you okay?

  • @MiddleCross378
    @MiddleCross378 4 роки тому +7

    Awesome tutorial as always. I ran into a bit of an issue, when I was loading one of my scenes, it just stayed black. I wasn't getting any errors oddly enough. I found out that my scene was named something like "FirstScene" but I was trying to load "FirstScene1" so it was just loading a black screen. So if anyone is having that issue, double check your spelling and references. Hopefully it'll help someone.

  • @tassodemo2316
    @tassodemo2316 4 роки тому +11

    This man is the reason I made my first “game”. Thanks Brackeys!

  • @SwiftGames_
    @SwiftGames_ 4 роки тому +12

    Tfw spent ages on this last night and brackeys has a tutorial one day later

  • @adrianbosborne
    @adrianbosborne 4 роки тому +6

    Hey Brackeys, can you please do a tutorial on active ragdolls. There are no good videos about it anywhere! Thanks.

  • @cinnamintie
    @cinnamintie 4 роки тому +26

    This is a really great tutorial. I can't believe I never knew animation overrides were a thing. That will be so useful in the future.

    • @UnitCodesChannel
      @UnitCodesChannel 4 роки тому +3

      Mint Fox Wait till you hear about DoTween 😋

  • @nishantkhalate5123
    @nishantkhalate5123 4 роки тому +11

    I miss the old "Thanks for tuning in at Brackeys" intro.

    • @animationspace8550
      @animationspace8550 3 роки тому +1

      I miss brackeys

    • @IDontReadReplies42069
      @IDontReadReplies42069 3 роки тому

      @@animationspace8550 i miss my dog

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

      ​@@IDontReadReplies42069… I just lost my dawg
      my brother taught me how to chase the bag
      Get right in the field I had to make a bag
      The day he lost his soul, wish I could take it back
      I just wanna go get one mo' bag wit my nigga
      Wanna be rich forever for my dawgs

  • @ruler1559
    @ruler1559 4 роки тому +37

    Can you make a grappling hook tutorial?

  • @Warrorar
    @Warrorar 4 роки тому +3

    it should be mentioned that the Async loading you mentioned, is broken since 2016 in Unity.

  • @14swift20
    @14swift20 4 роки тому +1

    Ay yo brackeys I am trying to start making game this might surprise you but I am a 11 YR Boy and I want to start early and I do not want give up like some of my past friends in reality fun is what really drives me to success in life bro.You are really awesome

    • @0hNothing
      @0hNothing 29 днів тому

      hey man you still making games?

  • @JacksonXtreme
    @JacksonXtreme 4 роки тому +24

    When swapping scenes for my game I used LoadScene(’Insert Level Here’) as an on-click function for my buttons. The transition might not be hard, but upon using a loading screen as a transition, you might need to look at both this tutorial and the loading screen tutorial.

    • @Furiousky
      @Furiousky 4 роки тому +4

      where is the loading screen tutorial, is it from brackeys?

  • @varuntaneja7073
    @varuntaneja7073 4 роки тому +3

    I already have another canvas in the scene and it's elements are visible over the transition canvas . What should I do ?
    Edit : Found it . There is a sort order option on every canvas

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

    I have all the code right but it just doesn't work :(

  • @inging421
    @inging421 3 роки тому +1

    it fades into a blue screen. thanks for wasting 2 hours of my life brackeys!!!

  • @KapybaraKSP
    @KapybaraKSP 3 роки тому +3

    Y'know... When I started I'd have to come to this channel to understand EVERYTHING... Now... I added this feature to my game entirely by my self, making educated guesses from what I previously knew and it worked first time. I have you to thank for this, I actually have learned and made progress on what will be my first fully complete, fleshed out and time consuming project.
    I'm going all out on this game, but it's not something I plan to release in a month, but probably two years to give me enough time, and that's because of everything I've learnt from you!

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

    anyone know how i could do this but instead of OnMouseDown its when i press a button in my start menu?

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

    I start at title, the go to a main menu, the transition canvas is draw behind the menu, is there a way to bring it in front, since I put the hole transition system in a perdurable singleton?
    Awesome tutorial, as allways.

  • @iangraham6730
    @iangraham6730 4 роки тому +7

    I just can't get enough of Brackeys!!

  • @jonas0608
    @jonas0608 4 роки тому +1

    I have a Problem and don't know why (not over this video): Can someone tell me why my Unity remote 5 doesn't work? I made me a developer in Options and turndes USB-Debugging on. I switchen in Unity Editor to any Androit Device and linked my Smartphone to my PC. I hit Play but it didn't work. An answer would be nice if someone knows a solution. Tank you.

    • @GeorgeWulfers_88
      @GeorgeWulfers_88 4 роки тому

      Lol, I have not used that at all in ages! I don't think they still keep up with it. Do they? I use app center to upload my APK so I can download and install it on my phone. (works well for teams but you don't need to use it).

  • @Taterzz
    @Taterzz 3 роки тому +1

    oh neat a simple tutorial to make transitions.
    wait 19 minutes what
    but more importantly, can i star wipe?

  • @headphones_guy777
    @headphones_guy777 3 роки тому +1

    while this is a really great tutorial I kinda wish you added how to play the animation when entering a trigger

  • @shurik1269
    @shurik1269 4 роки тому +1

    Have a problem with my code.... I copied everything right but it still gives me a lot of errors like 12
    here it is:
    using UnityEngine;
    using UnityEngine.SceneManagement;
    public class LevelLoader : MonoBehaviour
    {
    public float transitionTime = 1f;
    public Animator transition;
    // Update is called once per frame
    void Update()
    {
    if (Input.GetKey(f))
    {
    LoadNextLevel();
    }
    }
    public void LoadNextLevel1()
    {
    StartCouroutine(LoadLevel(SceneManager.GetActiveScene().buildIndex + 1));
    }
    IEnumerator LoadLevel(int levelIndex);
    {
    transition.SetTrigger("Start");
    yield return new WaitForSeconds(transitionTime);
    SceneManager.LoadScene(levelIndex);
    }
    }

    • @shurik1269
      @shurik1269 4 роки тому

      no forget it I found my mistake
      IEnumerator LoadLevel(int levelIndex);
      :/
      im dumb

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

    @Brackeys in my favorite youtuber, this couldn't have been more perfect. I am making two scenes and couldn't figure out how to switch them.

  • @MrJoss1996
    @MrJoss1996 4 роки тому +1

    Hii, this transitions its only for 2D games?

  • @Jonathan-le2rs
    @Jonathan-le2rs 4 роки тому +2

    I have some questions first of all when im on my last level and click i get sent in scene view since i dint have a scene to load. Second how can you set points where you walk and get sent to the next scene instead of everytime you click.

  • @dmitrijpopovich9789
    @dmitrijpopovich9789 3 роки тому +1

    public void LoadNextLevel()
    {
    StartCoroutine(LoadLevel(SceneManager.LoadScene(2)));
    }
    this code right here doesnt work, idk why

    • @Boop_r
      @Boop_r 3 роки тому

      cos thats the wrong code

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

    To reverse anims,dont copy the timeline and create new animation!
    simply create an empty state in the Animator and choose your animation for that, but choose a negative number for speed, like -1
    and then animation is reversed!

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

    Watching and I was like, "Alright, informative as always. All is well." then all of a sudden "literally" shows a picture of Chris Traeger from Parks and Recreation. :p LIKED.

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

    Amazing tutorial! Screen transitions are seemingly a detail in games but it makes the experience much more comfortable than just switching from one scene to another. I put this script and animation into a prefab with my camera and can comfortably use it in any scene. Truly your channel makes stuff seem easy ♥

  • @raynvancleef
    @raynvancleef 4 роки тому +3

    Can you do an vr tutorial for unity? That would really help😋

  • @rvv27
    @rvv27 4 роки тому +1

    Brackeys has more followers then Unity itself. Lol

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

    This is great! Is there a way to wait till the next level is loaded completely? Or we can only use the animation duration to judge how long the level might take to load?

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

    This is super useful, especially for my game, because switching a scene without a transition is super rigid and is quite ugly. This helps immensely, so thanks again Brackeys :)

  • @alberthilani1824
    @alberthilani1824 4 роки тому +1

    Hey brackeys.....youre realy talented programist....hope you gonna have nice future with this work....can you just make a video how to make a backstory before the game start....and thank you

  • @turksinnovations
    @turksinnovations 4 роки тому +1

    That Homer Simpson woohoo @ 18:34 😂 when your code finally works.

  • @ralphcalzada4767
    @ralphcalzada4767 3 роки тому +1

    i started game dev because of this channel

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

    Hi, is there anyway to prevent the scene transition from playing again when reloading the same scene?

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

    I was having the problem where my animations were running in reverse order. Finally figured out that I had clicked the (unmarked??) circle next to Animator -> Parameters -> Start and that, for some reason, reverses the order. This would be cool if there were any visual indication as to what that circle is or does. Unity Editor really does like to make things difficult for newcomers.

  • @DigitalDesignDude
    @DigitalDesignDude 4 роки тому +1

    11:31 Rather than using a coroutine,
    wouldn't it be easier just to trigger the switch scene code on the last keyframe of the transition animation? (trigger when screen is all black)
    Animations do allow for triggering functions on different frames.
    and the canvas could be set to don't destroy so that the 2nd half of the animation still plays through to the next scene (fade from black to fully transparent)

  • @TheJacobKing44
    @TheJacobKing44 3 роки тому +9

    If anyone is having trouble: remember when animating to select the crossfade object to create the animation, right click the animation tab and LOCK IT, then record and change the Image alpha. Been stuck trying to do this for about an hour xD

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

    hey how can i set animation canvas over the menu canvas so that it can cover my menu and, reverse the order of animation canvas after the execution, so that i can interact with my buttons...... help means lot to me..
    thank you

    • @tas0s
      @tas0s 4 роки тому

      no one helped you

  • @bevelang11
    @bevelang11 4 роки тому +1

    Could u pls update the new input system? It changes so much

  • @teknolojidelisiasdf9703
    @teknolojidelisiasdf9703 4 роки тому +4

    I wish unreal engine 4 had c++ tutorials like this.

    • @hriday684
      @hriday684 4 роки тому

      This is C, not C++

    • @teknolojidelisiasdf9703
      @teknolojidelisiasdf9703 4 роки тому

      @@hriday684No its c# but i meant I wish ue4 had tutorials (of c++) like this.

  • @lordpickaxe788
    @lordpickaxe788 3 роки тому +1

    Your clip of Bercow shouting Order had me ROFL - it was so unexpected and awesome!

  • @CoolJosh3k
    @CoolJosh3k 4 роки тому +1

    Issues arise if the scene is not preloaded. You could end up with a black screen for several seconds!

  • @ZeroStas
    @ZeroStas 4 роки тому +1

    My animation that should play when level starts doesn't appear but it sure does fade to black when level ends.

  • @claudedebetaz7818
    @claudedebetaz7818 4 роки тому +1

    Goodness me, why so complicated Unity ? Powerpoint will do this with one click ! :-0

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

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.SceneManagement;
    public class LevelLoader : MonoBehaviour
    {
    public Animator transition;
    public float transitionTime = 1f;
    // Update is called once per frame
    void Update()
    {
    if(Input.GetMouseButtonDown(0))
    {
    LoadNextLevel();
    }
    }
    public void LoadNextLevel()
    {
    StartCoroutine(LoadLevel(SceneManager.GetActiveScene().buildIndex + 1));
    }
    IEnumerator LoadLevel (int levelIndex)
    {
    transition.SetTrigger("Start");
    yield return new WaitForSeconds(transitionTime);
    SceneManager.LoadScene(levelIndex);
    }
    }

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

      thank me later

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

      @@palvelusmusic my code is the exact same but for some reason the animation keeps looping do you know how to fix that?

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

      @@zoaib. disable looping in animation

    • @zoaib.
      @zoaib. 2 роки тому

      @@palvelusmusic thx man

  • @LeGraypaw
    @LeGraypaw 4 роки тому +1

    Instead of creating a prefab and dragging that into every scene would it not be more beneficial to call "DontDestroyOnLoad()" in that script?

  • @repulsivegel3640
    @repulsivegel3640 3 роки тому +1

    Does anyone know how to trigger this with an in-game trigger rather than a button input? I've been trying to figure it out but I'm having trouble.

  • @chewico3d133
    @chewico3d133 4 роки тому +1

    Can you do a video of the same but the efect of transition is that the screen is difuminan?

  • @CatptainWhiskers
    @CatptainWhiskers 11 місяців тому +1

    Thank you so much for this!! Now I can proceed to finish my homework assignment!!!

  • @NestedMango
    @NestedMango 4 роки тому +1

    It's always lots learning to watch your tutorial 💙❤😍

  • @aelsi2
    @aelsi2 4 роки тому +1

    3:58 That's not true! You can remove color components like r, g and b you don't need from the animator and leave only the a component!

  • @SophieAnteboth
    @SophieAnteboth 4 роки тому +1

    Cool tutorial.
    BTW you can put the crossfade object to a specific layer and hide it in the editor, so it doesn't block the view.

  • @IndieMarkus
    @IndieMarkus 4 роки тому +1

    Interesting to see you remake a video about something you already did 2 years ago less elegantly. If you go through the trouble of creating a loading screen, then please do the async method for performance's sake.

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

    This is so weird... I was just looking for a tutorial on this, like TODAY. And what do you know, Brackeys provides.
    Thank you so much mate, don't know what I would do without you!

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

    I'm pretty sure I did the code correct but it isn't giving me the transition option, can someone check it??
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.SceneManagement;
    public class SceneLoader : MonoBehaviour
    {
    public Animator transition;
    public float transitionTime = 1f;
    // Update is called once per frame
    void Update()
    {
    if(Input.GetMouseButtonDown(0))
    {
    LoadNextLevel();
    }
    }
    public void LoadNextLevel()
    {
    StartCorourtine(LoadLevel(SceneManager.GetActiveScene().buildIndex + 1));
    }
    IEnumerator LoadLevel(int levelIndex)
    {
    transition.SetTrigger("Start")
    yield return new WaitForSeconds(transitionTime);
    SceneManager.LoadScene(levelIndex);
    }
    }

  • @natebrks
    @natebrks 4 роки тому

    Set up with a OnTrigger2d() and the fade in works, but the fade out doesn't. the fade out is trigger i playing in the animator controller window, but nothing is happening on the screen. Anyone have any ideas?
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.SceneManagement;
    public class LevelExit : MonoBehaviour
    {
    [SerializeField] float levelLoadDelay = 3f;
    public Animator transition;
    private void OnTriggerEnter2D(Collider2D collision)
    {
    StartCoroutine(LoadNextLevel());
    }
    IEnumerator LoadNextLevel()
    {
    transition.SetTrigger("Start");
    yield return new WaitForSecondsRealtime(levelLoadDelay);
    var currentSceneIndex = SceneManager.GetActiveScene().buildIndex;
    SceneManager.LoadScene(currentSceneIndex + 1);
    }
    }

  • @ronaldlee5324
    @ronaldlee5324 3 роки тому +1

    there a error when StartCoroutine(LoadLevel(SceneManager.LoadScene("scenename")));

  • @Scrubby.55
    @Scrubby.55 2 роки тому

    public Animator transition;
    [SerializeField] float waitTime = 1f;
    // Start is called before the first frame update
    void Start()
    {
    if (Input.GetMouseButtonDown(0))
    {
    LoadNextLevel();
    }
    }
    public void LoadNextLevel()
    {
    StartCoroutine(LoadLevel(SceneManager.GetActiveScene().buildIndex + 1));
    }
    IEnumerator LoadLevel(int levelIndex)
    {
    transition.SetTrigger("Start");

    yield return new WaitForSeconds(waitTime);
    SceneManager.LoadScene(levelIndex);
    }

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

    Pretty sure that is not a “cross fade” but rather a “fade to/from black”.

  • @martin-gaming
    @martin-gaming 4 роки тому +2

    But every time i reload the Scene the half animation ist playing.

    • @shlok975
      @shlok975 4 роки тому +1

      this happened to me too.but i found the solution:we have three canvases namely scene1canvas,loading screen canvas,screen2canvas.in scene1 and scene2 canvases go to render mode and set them to screen space- camera.then in the new slot for camera that appears,drag the main camera.make sure loading screen canvas is in screen overlay render mode,that should do the trick.

  • @ShotTheLast
    @ShotTheLast 4 роки тому +1

    Nice video but I think you should make another one about scene management like loading multiple scenes with additive mode. That way you can have a single scene handling persistent objects (like the transitions) instead of puting the same prefab in all scenes

  • @HAWXLEADER
    @HAWXLEADER 4 роки тому +1

    Why don't you just play the same clip in speed -1?
    You don't need to do the switchy swotchy in the keyframes for a simple reversed animation ^^

  • @icoivo5529
    @icoivo5529 4 роки тому +1

    Brackeys can you make a video about making a multiplayer scene transition?

  • @rodrigocosta978
    @rodrigocosta978 3 роки тому +1

    Anybody else had an issue where in the Inspector for the LevelLoader, the options "Transition" and "Transition Time" did not appear after saving the code?
    If anyone has a solution I'll be very grateful, I really don't understand code and neither do I like coding :( but I need to do it for my assignment -_-

    • @reidcooper1467
      @reidcooper1467 3 роки тому

      I'm trying to figure this out too

    • @reidcooper1467
      @reidcooper1467 3 роки тому

      I didn't have parentheses after Public Void LoadNextLevel on line 21, that's how I fixed this problem

    • @rodrigocosta978
      @rodrigocosta978 3 роки тому +1

      Hey, yeah, It seems I, had made a few mistakes myself with spacing before or after '()' or adding a '.'
      My eye sight is pretty bad so some times I can't see the '.' I also had the mistake of adding 'if)' instead of '1f)'

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

    How do you make this when your beginscreen is already a canvas? in one if your tutorials you said to make a beginscreen with a canvas. but you cannot see the black screen if theres already a canvas.

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

      Same question here. The transitions work perfectly in the game scene, but don't in the menu scene. Have you found a solution by chance?

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

      @@TheExplorerFromEarth I have not unfortunately. I kinda stopped coding for a moment.

  • @TurboTed00
    @TurboTed00 4 роки тому +1

    What about bigger scenes that take longer to load on different hardware

    • @ssojyeti2
      @ssojyeti2 4 роки тому

      Trigger the animation on start instead of awake maybe

  • @aymericplanet4329
    @aymericplanet4329 4 роки тому +1

    Again another amazing work. I promise i soon as i have a salary i'll give you something on Patreon, because it's obviously thanks to you that i'll can find a game dev job with unity ^^

  • @migats2160
    @migats2160 3 роки тому +1

    3:02 seriously though the battery of my phone was empty.

  • @Asdzxc120
    @Asdzxc120 4 роки тому +1

    I can't drag the Crossfade in transition, but i can drag the image but its not working

  • @moosesnWoop
    @moosesnWoop 3 роки тому +1

    This channel still provides value. I think for the next 10 years, it's going to provide a lot of value.

  • @jonnyklein6717
    @jonnyklein6717 4 роки тому

    Instead of creating a courotine couldn't you just Invoke the method that loads the next level with a duration of 1 second? Than you get rid of those courotine things. Also using public variables for e.g. "transition" is against the rules of "object oriented programming" which c# is good for. Instead you could use [SerializeField] but i see that most people use "puplic" because its easier and faster to write.

  • @rezwan007
    @rezwan007 4 роки тому

    5 Years ago you started a tutorial on c#...but you stopped at episode 15...its 2020... waiting for 5 years for next episode....🙄🙄

  • @SarpSpeaksSometimes
    @SarpSpeaksSometimes 4 роки тому +1

    How about making a video about shooting projectiles? I watched your raycast tutorial and it was quite helpful, but I want to add projectiles to my shooting game that travel at a certain speed and inflict damage when they collide with something, a rocket launcher for example. A tutorial on that could be very helpful :)

  • @arkalexx
    @arkalexx 3 роки тому +1

    Yep, this channel is the best, I'm new In Unity like 2 weeks ago and I have learn a lot.