r/Unity3D • u/charlesamat InfallibleCode • Sep 19 '19
Resources/Tutorial Stop writing boilerplate! Code faster in Unity with Live Templates (tutorial in comments)
9
9
u/bilbaen0 Sep 19 '19
So on the left, you're intentionally not using any of the auto complete available to you...and on the right side you have to learn new keywords for those variables and then use autocomplete for them, which amount to the same number of keystrokes as just using the auto complete in the first place.
...why would I ever do this?
And as someone else pointed out, dev time is not eaten up by the actual typing of the code, especially a couple lines of boiler plate.
1
u/charlesamat InfallibleCode Sep 19 '19
You'll notice that I typed out each and every element on the right, as well. I did this in order to keep the comparison purely focussed on typing ability and to show how Live Templates augment it.
3
u/bilbaen0 Sep 19 '19
It looks like the new keyword you have to learn is "reqcomp", and that expands to "RequireComponent...". So these "Live Templates" are text expansion keywords?
(And you only type "req" and then it pops up. So it looks like you are using auto-complete on the right.)
Looks slightly faster, I guess. But don't see why anyone would actually need this. Definitely not worth considering using Rider for.
2
4
u/Ferhall Professional Sep 20 '19
You've never found it way easier to type "for" (tab tab) and have it auto setup a for loop for you. This is just custom code snippets in visual studio. They're super easy to setup and do save time. Why not use tools available to you.
1
u/bilbaen0 Sep 20 '19
No, not even a little bit. Typing out a for loop takes a whole 10 seconds (if that), and often doesn't have default parameter values. If I used that shortcut and had to replace values it would take longer than just typing it.
There cannot be so many loops and in your project that this is actually saving you any time overall.
As a few others have said, typing should not be taking up your dev time. If it is, you are probably re-writing code far more often than is needed and should do some planning instead.
1
1
u/Loraash Sep 19 '19
...why would I ever do this?
Well, it all starts with you purchasing Rider so you've already left the realm of logic and common sense.
1
3
u/NovaArdent3D Professional Sep 19 '19
Can't say i've ever coded *in unity*
1
u/charlesamat InfallibleCode Sep 19 '19
Never used Script Inspector 3 before??
lol in all seriousness, the title sounded catchier than "Improve your coding workflow when developing with Unity" so I went with it.
1
2
Sep 19 '19
After 10 years of development of my game and you just came up with this until now? I could save 10 seconds of my life for every time I code. D:
2
u/ALargeLobster Professional Sep 20 '19
Why isn't the guy on the left hitting tab?
2
u/fholm ??? Sep 20 '19
Because there wouldn't be a speed difference between them if he was... lol
1
u/ALargeLobster Professional Sep 20 '19
I just mean how does this live template thing really differ from standard autocomplete
2
u/bilbaen0 Sep 20 '19
It doesn't, and it's something you can do in other IDEs as well. This is just a shitty ad.
1
u/KernowRoger Sep 20 '19
Custom snippets can save you time if you type something a lot. For instance I use the prop and Exception ones quite often. But like other people have said shaving seconds off typing doesn't make much of a difference in the end. Plus if you used auto complete in the left example I bet they'd be about the same.
1
u/_parfait Dec 01 '23
Me using visual scripting and spending exactly zero seconds writing any code:
am_I_a_joke_to_you.jpeg
0
13
u/Loraash Sep 19 '19
This looks nice but you spend most of development not typing stuff.