Unite Berlin 2018 - Become a Speed Demon Being Faster at Everything you Do in Unity

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
thanks for making it to my talk titled become a speed demon how to be faster at everything you do in unity I'm yuma tsukumo's i'm from innoGames in hamburg germany which is pretty close to here some of you I imagine have travelled further distances than I have to be here so I won't waste any time and we'll get right to business I have to start this talk with a fair bit of warning this talk will be a very fast talk faster than the ones you've seen before so please take a moment to turn your brains up to 11 my dial is behind my left ear if you're one of the older models it might be behind your head please take a moment to do that but don't worry if you miss any information all these slides this unity project and all the information that I share with you today will be available at the URL that I will reveal at the end of the talk so what do I mean by everything when I say how to be faster everything you do in unity as developers and creatives there are innumerable number of things we have to do the unity to be able to develop our games day to day these could be writing scripts fixing bugs creating levels designing UI setting up prefabs creating animations importing assets making bills building asset models managing project settings using third party plugins writing shaders making light Maps using unity services profiling debugging and even more unfortunately we don't have all the time in the world to do these things depending on your project your budget and your target release date you might have less time than you would like to work on some of these things which is why it's so important to be fast and move fast so important in fact that some people have come up with a motto move fast and break things I'm gonna say right off the bat that I think this is a horrible motto they started with move fast which is really good but then they added break things who wants to break things amateurs break things or any of us here amateurs no we're all industry professionals so our motto is move fast that's it to move fast we need a methodology we need to know what we want to do then we need to know how we want to do it ideally and then we need to look at the limiting factors that prevent us from being as fast as possible in our day-to-day workflows so if you know what you want to do and how you want to do it the limiting factors are time to physically start meaning for you to physically tell the computer with the input devices keyboard mouse whatever what you want it to do and then for the computer to execute that action and this can be referred to as the iteration time if you don't know how you want to do something then we need to do some discovery and then the limiting factor becomes the time it takes you to find the information you need to continue your work continue your work if you somehow don't know what you want to do it's outside the scope of this presentation I cannot help you so let's take a look at what we can do to improve our time to action I think it's pretty safe to say the keyboard allows us to be much faster than the mouse right in unity you might do some actions with the mouse because there is no keyboard shortcut associated with it but we'll get to that in a moment it felt was pretty obviously that we want if we want to use the keyboards you want to use as many shortcuts as possible we also have a lot of tools at our disposal that we can use the speed of our workflows and finally we have automation which allows us to completely skip the required action altogether zeroing the time needed to take the action basically so so let's take a look at shortcuts I'm not going to go here come up here on stage and tell you about all the basic shortcuts and unity that'd be really boring so for the most common ones there are numerous videos and cheat sheets out there but these two that I've should I show here are the ones I like the most from brassey's again like I said once you get the presentation at the end of the talk from the URL you can check these out yourself just to name a few of my favorite shortcuts we have new game objects which is command shift n we have gameobject.setactive alt shift a to toggle it you can see over here for pop-up and then we have command shift a to add any component you want really quickly with this autocomplete menu so the important thing about shortcuts is that you need to accommodate your own workflow each one of us works with unity a little bit differently UI designers developers etc but even among developers and even among in just yourself day to day you work differently with unity so you have to make sure the shortcuts accommodate your workflow now there are a ton of menu items in unity and let's imagine you want to use a menu item but it doesn't have an Associated shortcut what do you do it's no problem you use this editor application that executes menu item API call let me show you an example let's say for some reason you find yourself going to the lighting settings for the scene a lot a sane person of course would go ahead and duck this but even then to switch to that you might want a shortcut how do we do it here we have an example lighting many item let's open it in writer let's up the font a little bit is that better so really simple we create an editor script public glass lighting menu item name of the class doesn't matter we add one static method in there name of the method doesn't matter inside the method we call editor application that executes menu item and pass it the string to the menu item that we want to actually execute an important thing is then we add a menu item attribute to it we specify a menu item path for this again that doesn't matter because if you were to use this path and it's the same as going to the path of the other menu item the important part is the shortcut that we define at the end and I always get confused about which symbol corresponds to which modifier key so I end up always going to the documentation and here for menu item you can see it says modulo is ctrl on Windows command on Mac shift is pound and alt is ampersand so if you go back to our script and take a look we have command because this is a Mac shift L let's switch back to unity command shift L lighting window is highlighted and if you're really fast then you can use tab to iterate over the elements of the UI and then change things much faster than you would with a with a mouse not everything you want to do in unity is represented by a menu item though so what do you do in that case same thing create an editor script put a static method in there put a menu item with a shortcut on it and do whatever you want for example there is a menu item in unity for making parent out of one object and making the other selected objects its children for example I have the event system in the slide controller selected game object make parent makes the first selected object the parent the second and order the rest of the objects their children I don't like this so much I want a different behavior let's undo and I have this make parent custom script over here static method menu item with a shortcut command shift alt P what it does is it gets the filtered selection of game objects if there is no selection don't do anything calculate a position based on the selected objects for the parent to be at go ahead and create the parent game object new game object make sure to register an undo point so that you can undo if you thought this was a mistake and then set the position of the parent and for each of the game objects in the selection set their parent using the undo that set transform parent API so it automatically creates on dew points to the new parent let's see how it works so like these two command alt shift P we have a parent game object and the children beneath it if we undo we're back to normal there's also some advanced menu item functionality that you might not know about such as special paths validation methods and more let's take a quick look so this page on the unity tutorials website is about many items it begins with a very simple functionality that we already talked about but then goes on to some interesting stuff which is such a special paths so if in the string that you pass through the menu item attribute you started with assets then you have the chance to place your menu item not up top here but in the assets which is in the project view here following it right click here if you say assets create then it will be under the create menu over here if you use context this is really interesting you can put it on the right-click menu of a component so I have an example here I have my slides to achieve this functionality of showing one thing at a time i specify these game objects on my slide object over here you can see I have two text elements specified so that we can step over them but if we wanted to do it automatically so you don't have to drag everything in excuse me one by one I added a context menu item here gather text elements tent will automatically populated so you can really speed up your workflow you're a very specific workflow as you can see in my case with such functionality so next thing I want to talk about is for developers IDE shortcuts we all love and usually swear by our own IDE suite Visual Studio visual code JetBrains writer monodevelop what have you the thing that's important is that you customize to hell and back because we spend a lot of our time there we spend a lot of time writing code but none of us enjoy writing boilerplate code or code that we think the computer could write for us so I swear by JetBrains writer it really accommodates speed demons and it has great integration with unity that's getting better each day I'm not affiliated with them just love the product but let me just show you a couple examples so imagine in the slide class we wanted to give this whole project an enterprise architecture so we want to extract an interface out of it we could hit command shift or extract interface hit enter there's the interface if we don't like interfaces being in the same file as classes command shift our move to another file done this is just one really quick example so in writer I actually want to undo this or not save it at least alt enter and command shift are are really good if you go into the Preferences in the key map section you can see there are a ton of different actions in writer that can be associated with shortcuts and you can change these however you like let's take a moment to compare this with the options unity offers you in preferences not great so definitely customize your IDE one other thing I will mention is live templates so when writing code in unity you might use certain API is a lot debug log for example instead of typing debug log all the time even if you can do debug dot and then log will be the first one and you hit enter you can even be faster you can create live templates so here's one I've created called log equals debug log with an open parenthesis if I just go here in a method type log and hit tab automatically completes the debug log seems like a small improvement in the long term it saves you a lot of time especially if you take the time to do a lot of these things the next thing our tools so obvious unity comes with a lot of tools new ones are getting each day we heard of some new ones yesterday there are also third-party tools maybe you heard of this thing called the asset store the thing about the asset store is you have to really picky with the assets you choose from there I will get to that in a minute but nothing really beats writing your own tool so it's a really important skill to have being able to write your own tools and we'll get to why in a second so unity tools yesterday there was a session about cinema Sheen and timeline you might have seen it great for improving your workflow with cameras and animation but also a lot of other things and similar packages like this are being worked on by unity and developed and released and you can see some of them in the package man so I think this is new since 2017 some version didn't correct me later if I'm wrong in this project I have the incremental compiler which some of you might not have heard about we'll get to that in a bit we and I have text in Asheboro which is powering all the text you're seeing in the presentation but if you go to the OL section you can see cinema Sheen is there the new entity system is there High Definition render pipeline is there and a lot of other things you might not have heard of our list here and you can put them in your project definitely check it out next up is the unity github profile so not everything unity is working on at this moment is visible in the package manager because it gets there when they get to a point where they can do a release or a pre-release experimental release as they call it so some things are on the unity github profile let's take a look there so they have ton of repositories on here it says 224 if we change the type to sources now it's still the same 126 results and I just show you one example tools collection repositories used together all together all the little editor script and tools that we write for different projects they say so just a few examples reference finder could be quite handy missing scripts finder you might have noticed you need this from time to time package manager package designer preset importer so definitely take your time to take a look through the github repository of unity very useful stuff in there and finally the unity blog so the blog has gotten better better each year in my opinion in showcasing the new things that unity are working on definitely check it out better yet subscribe to it with an RSS reader and there also some brand new tools we heard about yesterday at the keynote that I'm very excited about kinematic ax which looks like Blackmagic nested prefabs anyone and the SVG importer these are all super interesting to me and I can't wait to play with them and the thing about it is usually these new packages replace your existing workflows with much faster one so it saves you time in developing your games so give them a give them look some North noteworthy third-party tools sorry that I want to mention SR debugger I use this a lot nowadays because we're doing some prototypes I can trigger it by tapping here I hope that today let's give it another try exit play mode enter play mode aspect Baris it's an in game console and profiler well not really a profile but it shows you what your game is doing so here's a console nothing in here right now let me log something there it is it's really useful if you're especially working for building for mobile devices to be able to have an in-game console that you can trigger with some hidden button or something that you can actually disable in your release builds to see what's going on because it really improves your iteration time this option section is great for specifying custom debug actions you might want to do so in one of my prototypes I have this filled with graphics options because I'm testing the impact of different graphics features on performance so here I just have this log time since start which is just a method and performance toggle between normal and high which sets the target frame rate to 30 and 60 which doesn't do anything in the editor so it's boring I know but let me show you what the code looks like it's our options custom it really takes very little code to put something in there which is what I think is really great about it you can specify a category if you want then it will put this category there just make a method it will show up as a button make a public property specify your own enum if you want to give it a nice name and then do whatever you want in there I set the application target frame 8 to the value we receive which is either 30 or 60 and the other thing that's really cool is you can go to the profiler pin it go to the options pin some options that you're interested in toggling on and off right now and then you can see it as you're playing your game you can toggle between the different options and see it's out how it's affecting your game for example all right let's get that out of the way another tool I want to mention is haste so Mac users probably know spotlight hit command shift or whatever shortcut you might have changed it to and then you can search for whatever you want right beat applications files anything on Windows you have the search functionality is pretty much the same nowadays Haise is pretty much spotlight for mac for unity sorry hit command K and this window comes up it says just type so let's say I want to go to some prefab that I have dot prefab there it is I can go to it select it drag it into the view or if I want to go to my scene and with that unity main that unity hit command down open the scene much faster one thing that's bad about this is as far as I know this tool is no longer being developed I can imagine so many different features being added to this like for example you type you find the prefab you want and then you put a space and type instantiate or some short short word for it and it immediately puts it into the scene and you're just that much faster so this is a really great opportunity if somebody wants to work on this another tool I want to mention is unity ripple repla stands for read evaluate print loop I think that I like to use for one-off code that I want to run so command shift are brings up this interactive c-sharp shell and then there I can write some code when I want to execute something but I don't want the hassle of saving it to a file because if I go to go to writer create a file write the code to come back to unity let it compile execute the menu item it just takes too long so here's one example sometimes it's useful to find the GUI D of some asset so we can write let me try to zoom in here a little bit bar GID weight first we need the path asset database that get asset path so it doesn't have autocomplete so you need to have a good understanding of the API and this probably won't compile but let's try selection that active object and then geo ID as a database path Oh database path to GID path and not working anyways this tool is also not being developed nowadays as far as I know but imagine this tool had autocomplete functionality and you could write your 1 of code in such a window how much you would be how much faster you would be in doing this one of actions you have to do in unity that example right let's move on writing your own tools very very important it's it can't be overstated how important it is to write your own tools and the unity editor is insanely extensible so just a shameless plug I have a couple United talk so in previous years where I talked about advanced editor scripting but you will find much more up-to-date ones if you just go on YouTube and search for editor scripting I recommend you do it the editor is insanely extensible it's one of the better strengths of unity I find but you got to choose the right method of extending the editor so you might be writing a custom editor which overrides how the component draws itself in the inspector and editor window that's just like any other window that we use in unity such as the project window initialize onload lets you initialize some script or some class as soon as unity start so you can do things in the background or something like unseen GUI which lets you draw scene controls which I actually have in this presentation if you can if I can zoom in here you can see these buttons do you see them they're drawn on the scene they're really hidden I set the opacity really low but they also let me go through the presentation but then later I realize I'm never gonna use those buttons so I just kind of hit them away and I just use the left and right arrow keys and also the clicker sends page up and page down key codes to the editor so I use those instead getting back to play mode alright automation there are a lot of tools at our disposal to automate things in unity one of the one one of those that I like the most is asset pre and post processors so when you bring assets into unity audio textures models etc there are ton of text import settings that you can set up and they really impact the performance of your game so it's really important to set the right settings and it's important not to not forget which settings to set so this is where this API comes really handy that you can automate this process so here I have a very simple example under script editor I have texture preprocessor since this is a presentation that's not going to be deployed to a device I don't care about texture compression so anytime I said one of my textures type to sprite I want texture compression to be just uncompressed let's take a look at an example I have an image here if it's a default texture type I can set the compression no problem but if I said to sprite this texture preprocessor will automatically set the compression to none so I don't have to worry about it small things they add up another one is serialization callbacks let's take a look at those here we have this page from the documentation gives an example of serializing dictionaries into lists of keys and values which I'm sure most of you have seen before but it's a hassle if you have to serialize and deserialize to list and then you have to worry about oh do they match up really just use a dictionary use the serialization callbacks to handle it seamlessly editor application callbacks are really important I showed you on Singh GUI there are more so hierarchy changed project changed these are really important callbacks kind of global callback so on receiving them you don't want to do something super expensive but they're great for really changing the behavior of unity and really modifying the editor to how you want it to work another one is on validate which will get called on a component anytime you change any of its values which is great for validating that the value ranges are correct and any other custom functionality you might want and post-process build attribute is of course great when you make a build if you're in a post process it in Xcode or change some files also a good one so we covered the things we can do to improve our time to action let's talk about the time to compute it might be tempting to think we can't have much influence here your computer as fast as it is and you can't do anything about how long it will take to compress the texture but there are some methods we can use first one is avoiding the computation altogether second one is delaying the computation to a more appropriate time speaking up the computation somehow and changing our approach completely so when it comes to avoiding something we can avoid texture import times how use the cache server you guys probably all know the cache server there's a new version out there I think version six or something that's really great for land-based if you're working at a big company having a cache server that caches all the assets is wonderful we had this in our project where when you switch to a platform such as iOS and Android and that et Cie and PVR decompression kicks in you're losing a lot of time another one is delaying so if you wanted to open a new project and the default target platform is a mobile platform and the texture compression is gonna kick in you're gonna sit there waiting for the whole project to open so you could just beforehand open an empty project or any other project you have go into settings change the setting to compress assets on import to false so that you don't have to worry about this because in most cases you don't need to see the compressed versions of the assets when you open a new project another option is speeding up compilation times this is a big pain point for me as your project grows and as you add more code to your project your compilation times go up obviously and as you had third-party packages as well so I really try hard to minimize this so what we what we would do or we could do still can but there are better methods it back in the day is put some code in the plugins folder because the code in the plugins folder gets compiled to a different assembly and if you change your game code but don't change code in this plugins folder then that code won't be recompiled and contribute to your recompilation time you can also use DLLs which is a bit cumbersome but nowadays we have this new feature called assembly definition files where you can specify which scripts should be which assembly and then the scripts you change will only be compiled with the other scripts in that assembly to speed up compilation times another thing is the incremental compiler which you saw when I opened the package manager it's in preview I think I had unity crash a few times because of this but you can see it's a Roslin based incremental compiler they upgrade the compiler it only tries to compile the minimum amount of code necessary based on your changes so the compilation times are really fast and you can't keep track of your compilation times with the tool called compile time tracker which I have here let's take a look let's go to a script important to trigger a script recompilation go to the console wait a bit compilation finish in five point 89 seconds using this you can really keep track of how the script recomputation time of your project grows over time it has a little window compile time tracker shows you a log of the compile times today and from yesterday and gives you an option to export it to comma separated value file which you can then use some graphing library to graph if you wanted to I plan to do that for my project soon and the final approach we can take is to change our approach completely to something so for example if you're really tired of script recomputation times you could imagine changing your approach to scripting are you tired of free complication times are you fed up with garbage collector spikes have you ever considered scripting in C++ it is possible this really genius guy Jackson Danson has released a package on github called unity native scripting let's take a look the library will allow you to write Unity scripts in native code C C++ assembly and the goals are making scripting in C++ as easy as c-sharp low performance overhead easy integration within a unity project fast compile times and not losing support from unity you could take a look at this it's not going to be right for every project some big project might consider this if you have a team of developers that are more comfortable in C++ and managing their own memory you could take a look at this it is a serious thing to consider whether you want to use this in your project but it promises really good things like not having to deal with the garbage collector and having total control no I also see PP surprises etc something to keep in mind something to check out so now we get to improving our time to information as developers we have to go to documentation a lot right unity has grown so much that we can't keep the whole API inside of our heads so we have to keep going to the documentation every once in a while and if you want to do that using a web browser you go to Docs that unity3d come wait for the load go to scripting API search for something we want menu item wait for to load I'm already really bored click again wait for to load and then read instead use a local documentation browser I have - on Mac menu item I already have it here let's search for something else as a database I'm already there and I can read the documentation that I was looking for really quickly there equivalents of this app on Windows one is velocity one is zeal they all use the same dark sets there are a ton of different talk sets you can you can download for these users can contribute out their own dark sets you can have cheat sheets it's really great make sure to take a look into it searching the internet nowadays when we run into a problem first thing we do we google it if it's a really tricky problem the answer might not necessarily be on Google might be on stack I mean you might not be able to find it so easily sometimes it's not there at all so at that point you have to ask other people when it comes to asking other people you have to write choose the right communication channel I like to use Twitter a lot because has a very high rate of communication but you got to find the thing that works for you you got to find where your network is so that you can ask these people and get the information that's inside of their heads and the final thing you can do is having the information come to you so this isn't a direct approach this is more of an investment that pays off in the long term but instead of always having to go and look for information make sure to sign up to some really good sources of information with an RSS reader or whatever you want and then have that information come to you read the good articles have the information in your head so that the next time you run into a problem you don't have to go searching for it again let's recap we talked about improving our time to action with shortcuts tools and automation we talked about the time it takes for the computer to execute the action and how we can improve ourselves and our speed with avoiding it delaying it's speeding it up and changing our method and finally time to information documentation search people and subscribing to good sources of information thank you very much this is the link that I promised you this whole project that I'm doing the presentation in is available there along with readme file that kind of succinctly tells you what all the information that I've given you today thanks so much if you have any questions please come up to the microphones let's start here yeah hello hello okay so as a unity project grows the amount of time between when you press the play button and actually being able to play it grows incrementally definitely so looking at the Unity source code I noticed that when you press play it backs up the entire scene who places it with a copy of that so you can say mess around with it right don't you press stop it replaces the backup scene to the original one all right currently there's no method for unity to just take to work out which bits of the scene it could bypass backing up so do a smart backup and then just put the dynamic ones in there I've written a script to actually like make a temporary scene to run loads of stuff that you know there's definitely not going to change like static objects like buildings rocks there's sort of stuff put in another scene and then you can sort of play the the game and then sort of unload those stuff back into a temporary scene so basically it stops backing up the stuff it doesn't need to back up because I had a project where like on a an i7 laptop he was taking about two and a half minutes to play that's a great two and a half minutes in playing and actually playing the game that's will the time wind off going I was that yeah so you use this approach of a minimal seemed to enter play mode with yeah but that that's right but I don't even believe that it's all recently that is there any units you're gonna do anything to help people profile them at the time we play and actually playing the game cuz there is that question is how to improve the time it takes to enter play mode in case it wasn't audible I remember reading an article about how to profile the time it takes to enter play mode I don't have it ready here but if you search you know profiling play mode unity I'm sure you will come across it I haven't done much investigation into that area myself but I feel your pain I know how it can be thank you do you prepare your editor tools in any way piling profile them of course so if you write really simple editor tools editor windows you don't necessarily need to profile them because you won't feel any delay but as your pro editor tools get more and more complex and you do a lot of computations in there you will want to profile it sorry how do I do it you can profile the the editor right so if you go to the profiler there is this button for profile editor and then you execute some action you look there and you can see what's happening and he shouts edit subscription suit of course okay thank you sure I've started using assembly definition files and I'm come across some issues when it comes to external packages so once you put an external package into its own assembly you'll also have to put every single editor folder into its own assembly I've heard of this and then they reference each others so you have to restructure the hierarchy of the scripts all right every external dependency to get this running I was wondering if you had some tooling or ideas for that I don't unfortunately so assembly definition files are relatively new I know I haven't had a chance to use them yet because my project at the moment hasn't grown to that size but I know that maybe you talked to one of the unity experts set up a time with them and then they might be able to give you some tips on how to deal with this thanks Willie thank you hello can you tell us - which RSS feeds you are subscribed to sure I hope there isn't anything inappropriate in there let's take a quick look so we have Alan Saucony which I met like one hour ago on the conference floor his tutorials on unity are absolutely amazing with CC all articles I would highly recommend you follow it another one I think we have some unity related ones here k 0 he's a Japanese unity developer as far as I know he does amazing unity graphics related projects you'll find a lot of lots of inspiration here lots of bleeding-edge graphics prototypes I subscribe to the unity roadmap which tells me whenever they change the planning status of a feature for example physics 3.4 version change I can see that they plan to put physics 3.4 in unity 2018 dot 3 which is very useful and bunch more so actually my last year's unite talk was about being a resourceful developer if you check that out you will see me talk more about what which sources I subscribe to thank you thanks so much [Applause]
Info
Channel: Unity
Views: 12,899
Rating: undefined out of 5
Keywords: Unity3d, Unity, Unity Technologies, Games, Game Development, Game Dev, Game Engine
Id: apct9_tsBdA
Channel Id: undefined
Length: 35min 2sec (2102 seconds)
Published: Mon Jul 23 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.