Saving small script to rip later??

I just want to hear you guys on whether my learning approach is completely off track…

I do lots of small beginner tutorials but I am finding my self to search more and more for specific things and then I save that script code.
I.e I have a script file for player movement and one for collision etc…
I want to build many small specific script like this and then when creating a project I just
copy code from one of those scripts.

Is this something programmers do??

Of course I want to learn it my self but it is a lot to remember…
Br Hamid

For a while, yes. Then it sometimes becomes more simple to just implement the thing than find where we put certain scripts and modify to the different requirements.

Do not forget, you may be happy with the pure “it is moving, good enough” for now. But after a while it becomes more nuanced. You will envision specific ways it’s moving. So you will ditch the carefully constructed “the movement” script and reimplement it differently. But it will be okay, by then it becomes second nature.

3 Likes

Often if it is something that I am going use again and again (like array or math methods) I will add it to a one of a collection of utility classes that I use in all my projects. For stuff I use infrequently, or just want to save for later, I use snippet library that lets me keep and organize little chunks of text/code. I use SnippetsLab SnippetsLab - Keep Your Code At Your Fingertips) but there are many such tools available.

2 Likes

Thank you guys.
I am still learning.
And I found my self writing small codes on paper notes here and there, and whenever I get to a computer I test it out…
so yes I am in that “excitement” phase.
Coming with no programming background and my job is NOTHING related to programming I found it sometimes overwhelming. I have 3 small boys at home. So this is purely my own grown passion I exercise when the kids gone to bed.,
I like the snippet library you mentioned. I need to look into that.

2 Likes

There are lot of times it comes in handy. Unity has a lot of things that are specific and even some that isn’t fully documented (or documented clearly) I have tons of snippets that I have either discovered by accident or other have that come in real handy on certain cases but would be a pain to google later. There are some odd cases with rendering the UI that are the same. I will save a snippet if it is something that too me more that 5 minutes to find in via google. I use it lot for things like clever shader methods or just other solutions folks have come up with (I also just use it as a develop note pad)