- Home /
Help me help myself in C# mono scripting
What I struggle with is ADHD, and I have a very strong insight for logic flow, but get tied up in the technical quirks. I can make great flow charts and logic streams, but struggle in filling in each block with the proper syntax.
I don't mind doing tutorials and lessons, but often cannot come up with the specific keyword or phrase needed to plug in to Google to pick up the required tutorials.
So what I am seeking from you guys is a link or what keywords to search for on content that is about the core use of unity syntax or reserved keywords so I can create code for things related to tutorials and not just carbon copies.
I've spent many hours doing online tutorials and fully get what is going on in them, but lack the vision to see what it is in the code that is specific to the tutorial and what is not. As many of the things I've learned when trying to use in a way other than the tutorial constantly give me red console errors.
Its learning how to take code taught in anyone's tutorial and see it for what I can do with it beyond what they did in the example.
I'm sure this has been asked before, but I seem to be having trouble finding a baby step tutorial that is cut and dry to the point. I often feel on ultra beginner videos like I'm saying ok I get it, move on already.
I think you're looking at the wrong tutorials. If you can't yet write code on your own, from scratch, without following a tutorial, you should be looking into the program$$anonymous$$g language in general, and not into "here is a script how to make a gun fire and its bullets hit something".
If you look at examples like that, but not know all the fundamental basics of c#, naturally you will have a hard time adapting the code to suit your needs.
Additionally, I would be more than happy to give you a hand at learning c# and maybe help solve a pesky compiler error or two. Check out my profile, there should be an email visible, write me up :)
Do you have any program$$anonymous$$g experience? Do you know to use basic c# logic sentences, iterations, scopes, etc?
That can make a difference about what kind of tutorials we can recommend you.
Heres an example of how I don't understand the unity documentation clearly.
using UnityEngine; using System.Collections;
public class example : $$anonymous$$onoBehaviour { public Transform curTransform; void Start() { ExampleScript someScript; someScript = GetComponent(); someScript.DoSomething(); } void Example() { curTransform = GetComponent(); } }
it uses the same names so often and other names that sound like reserved words, but are not. I try to use the editor periods to help me with available stuff to attach, but sometimes I dotn know if the next thing goes in "" , <>, {}, [], (), ect..
Yes I do have coding experience, I had to learn visual basic user form scripting on the developer tab within excel for the purpose of creating form interface to solve machine design math that is complicated but commonly used. Or to create components of virtual models based on changeable inputted parameters. like is the pipe x long and x diameter, and x thickness.
I'm cisco hardware and network certified along with the Autodesk 3D modeling professional diploma.
So its hard to learn this basic stuff when I understand the gist of its meaning and just want to know what each word and , . " / : ; brackets, etc..... all means at the base level not what it means in relationship to what its attached to.
I've found some good books on C# and what not, but it really does seem foreign compared to the unity script mono C# Ill attach a logic chart I made, and shows I can understand the flow of code logic, just not getting how each keyword and punctuation affect it.
Also I did make a text and image based videogame fully in excel VBA user forms, took me months and its thousands of lines of code. but its kind of cool That's why I like C# as it feels very similar to VBA.
http://answers.unity3d.com/storage/temp/12816-game%20flow%20concept.jpg
"" , , {}, [], ()... I mean this is all SUPER basic stuff. If you don't unquestionably know when each of these should be used, you should really go over ALL the basics. And I mean down to variable types and how each is defined.
Sigh... Right.
"" defines a string. Everything inside " " is a string.
() is used to pass arguments to functions and methods.
[] is used with arrays and various other container types. $$anonymous$$ost commonly in accessing elements of a specific index.
{} denotes a code block. Basically shows when classes, functions, if statements, cycles and pretty much anything else starts and stops.
bit tricky. $$anonymous$$ost commonly used to specify a type of variable, when not actually declaring a new variable. Like when you're making a list. You want to specify what type of variables that list will store.
C# and VBA have similar roots. I think that what you need is not how to program (except for a little C# syntax) as much as the Unity classes and idioms. You're also going to want to make methods as small as possible.
I've found scripting tutorials that covert the parts of the API I want to use to be hard to find. The Unity Design Guide by Example book is a decent intro to using Unity and has enough scripting to get your toes wet.
One thing you might try is to learn enough to get started and not worry about needing to know everything until you have specific questions. Then look for a tutorial on the area you want to know about or google then ask questions.
Answer by Jamora · Jul 04, 2013 at 07:27 PM
Seems like you need to learn basic C# syntax. Here's what looks like a good tutorial, based on a quick read.
http://www.tutorialspoint.com/csharp/csharp_basic_syntax.htm
After having digested (and tested for yourself!) everything in the tutorial, have a look at the Unity's API... or a beginner's tutorial on Unity to learn all the basic classes and consepts.
Been glancing over that link, it does have the kind of base purpose of the content im seeking, thanks so much, now to try and not get confused with the differences in unity mono. I've seen some already, like // does not mean comment in that syntax lessons. the part im trying to avoid is having to install visual studio and learning how that editor works, it would be nice if this kind of document existed for unity C# specifically. ive tried installing visual studio in the past, and it was a headache, between all the setup that looked to be high level I.T. related, or only a limited time trial install.
What...? // DOES mean comments. In every editor. Its a language thing, nothing to do with the editor you're using. // and / / are the two ways to specify comments in c#, c++, java, php and many other languages.
copy and pasted this from the link
Comments in C#
Comments are used for explaining code. Compilers ignore the comment entries. The multiline comments in C# programs start with / and ter$$anonymous$$ates with the characters / as shown below: / This program demonstrates The basic syntax of C# program$$anonymous$$g Language /
Yes, and the very next line goes
Single line comments are indicated by the '//' symbol. For example.
This is EXACTLY true for mono, as it uses c#, as does this example. Whats different?
oh my bad, I was just skim$$anonymous$$g threw page to see if it was the type of guide I was wanting. Didn't want to keep reading as my intent was to start at the top when I have a few hours to sit down and dig in with a pot of coffee on, lol. Ive never seen the multi line version ever used in unity tutorials. I was actually trying to google how to make it so I don't need to put // in front of every line, for the purpose of making code not visible but yet keeping it on screen. Like when a video shows multiple ways to script the same thing, I have every line of code // on all the ones that are not used, but wanted to keep them there for reference. many of my scripts have 5 lines of // on each one for every statement just for my own notes, lol.