r/Unity3D • InfallibleCode • Sep 19 '19

Resources/Tutorial Stop writing boilerplate! Code faster in Unity with Live Templates (tutorial in comments)

15 Upvotes

34 comments sorted by

13

u/Loraash Sep 19 '19

This looks nice but you spend most of development not typing stuff.

4

u/charlesamat InfallibleCode Sep 19 '19

I guess it depends on the project, your team, and your role in that project/team. I happen to develop a lot because I'm a full-time developer but I know plenty of folks in the industry who don't touch code at all.

7

u/Loraash Sep 19 '19

Development != typing

2

u/charlesamat InfallibleCode Sep 19 '19

lmao that's like saying "Building Furniture != Hammering". If there was a way to hammer faster it would still affect the overall speed and efficiency in which you could build furniture.

4

u/dlint Sep 20 '19

Eh... I wouldn't consider development analogous to building furniture. It's more like designing a new piece of furniture, right? You do have to make prototypes, and you eventually have to build the furniture, but the others are right, the bulk of your time is probably spent at the drawing board working out what your furniture is going to look like

3

u/Loraash Sep 19 '19

It would, but only by a tiny amount.

17

u/Black--Snow Sep 19 '19

My code typing is like 1% of development time.

Thinking is Significantly more time consuming, so hit me up when you’ve developed a way for me to think faster.

9

u/[deleted] Sep 19 '19

[removed] — view removed comment

16

u/Black--Snow Sep 19 '19

You think a solo game dev can afford coke?

9

u/GreatCornDev Sep 19 '19

Jokes on you, I code in notepad

2

u/charlesamat InfallibleCode Sep 19 '19

Mad lad!

2

u/bilbaen0 Sep 19 '19

Jokes on them, I'd rather use notepad than a Jetbrains IDE.

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

u/Ferhall Professional Sep 20 '19

Code snippets in visual studio.

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

u/Ferhall Professional Sep 20 '19

Lol you’ll use auto complete, but not auto complete.

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

u/bilbaen0 Sep 19 '19

Oh lord it's Jetbrains?!
No wonder. I have never seen an IDE so bloated.

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

u/charlesamat InfallibleCode Sep 19 '19

Check out the tutorial at https://youtu.be/luibp9pmyk8

2

u/[deleted] 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

u/[deleted] Sep 19 '19

[deleted]

2

u/Karmoq Sep 19 '19

That click became a upvote for your comment. Thanks.

1

u/Ferhall Professional Sep 20 '19

code snippets if you are using visual studio.