"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
@@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💀
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.
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!
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.
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?
This is brilliant, I love how once it's set up you can create just about any transition as long as you can make it in the animator. Definitely something I'll be making use of.
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
If you don’t want to use a coroutine for some reason, another way you can do this is with keyframe events. From your script, have a method that starts the animation. Then, on the last keyframe of your animation, set up an event that will fire off a method to load the next level.
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 } }
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);
@@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!
My words can not describe how much I want to thank you for what you did to me, you really did help me to improve my life. When I start to earn money, first thing I will do is donating 100$ to your website. Really thank you.
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.
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.
I used DoTween to fade to black, and back again, in my game. Super simple to do; like one line of code to fade and one line to fade back. Well I should say my coworker did it. I'm too much of a Unity noob to do much lulz.
This is a great tutorial and will be very useful in my progress. But can you explain how can I apply this crossfade transition to a button in my main menu?
Would it be easier or idk simpler to just play the animation in reverse, like speed -1 or something? Maybe not in some cases, depending on what it’s doing
I have a problem.. In my second scene, I reference a TextMeshProGUI that will print some dialogue. When I play this second scene directly, no errors. But if I load the first scene first, I instantly get a NullRefException saying that my object can't be found. I don't know how to fix it. Looks like some objects takes longer to load, or dunno.
You are probably not setting the text variable on both scenes and you are probably also not checking for this text mesh pro variable to be empty or null, therefore crashing your application when trying to access this object. Make sure that before you use it you do the following// if(textMeshLabel != null) {textMeshLabel.text = "whatever text you want here"; } This will protect your code from accessing invalid data and crashing. I hope this helped. If this was not the issue then make sure to explain it further.
You just gotta make the enemy constantly or every second shoot out a raycast towards your direction and if there isn't any obstacle in the way, then turn on the enemy agent, assuming you already got the navigation mesh setup stuff done, which btw i think brackeys has a video on it too.
Are you using 3d? If so: You could try making a cone shaped object and attach it to the enemy. Then, check for collisions with the player tag / layer. If a collision does occur, then set the player's position as a target and get the enemy to follow that position. This would be better than a raycast since it allows for line of sight. As in the enemy can't lock on to you if you're behind him. Alternatively, if you did want 360 degree vision, using an overlapsphere with a player layer bitmask may be better as they are more performant.
QuincyIsCrispy I didn’t understand anything because I started with unity for 2 days ago but still thx 🙏 never got this much reply’s and help before (my lesson learned: be early to comment otherwise no1 is gonna see it)
Nice video! I did I think everything the same (just I put the input to change level on my levelCompleteChecking script, but... works only fade in animation at the beginning of new level(scene), so fade out (from scene graphic till black screen) doesn't work.. not sure what Im doing wrong. One thing I noticed that Crossfade animator controller wasn't atumatically created, so I had to create it manually (maybe its because of a bit older unity version?)..
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.
Hey @Brackeys!, been watching your videos for a while now (almost a year, i think) so very new here, but i was just re-watching this, but stumbled upon something called 'tweening'. At which levels on performance do you think its worth? could you make a video to share some light on the matter?
Can you provide a link to this? I know I have used something similar in a professional capacity for some mobile games and just want to be sure it is the same one before I say that it is good or nor. :)