Breaking up Code in Unity (Important game dev tips for beginners)
Video Statistics and Information
Channel: Lost Relic Games
Views: 56,943
Rating: undefined out of 5
Keywords: breaking up code in unity, code separation, game dev tutorial, lost relic games, c# coding for unity, how to code c# in unity, one script or many in unity, indie game developer tips, unity3d, howto, make a player move, game dev classroom, 2d player controller, tutorial, unity project setup, unity player setup, best unity tutorials 2020, multiple script files in unity, game dev advice, john stejskal, dani, Brackeys
Id: _vj1GASSO9U
Channel Id: undefined
Length: 18min 36sec (1116 seconds)
Published: Sat Feb 15 2020
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.
Good practice, but the execution could use some further polish.
The reference clutter in the inspector and manual fiddling to set it all up could be automated to make it foolproof and a lot cleaner.
Using
[RequireComponent]
would make it so it can't be set up wrong, and make it quite a bit simpler to set up further characters, since you could simply drop any of the scripts on a GO and the others will be added automatically.Manually messing with the execution order can end up getting really bloated as the project grows. It's nice to see things visually in the execution order, but it's further manual and error-prone work you might as well skip. The main script could be initializing all the modules ensuring that things exist in the order you need them.
edited: The audio sync has self corrected. some youtube glitch. Thanks to those who let me know.
I always do this! I mostly do it so the AI moves more or less the same way as the player and they feel "in the same world". Also, interface everything and you got an Iterators dream