Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by MythN7 · Jul 04, 2013 at 03:08 PM · scriptingbasics

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.

Comment
Add comment · Show 7
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Em3rgency · Jul 04, 2013 at 03:23 PM 0
Share

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 :)

avatar image jovino · Jul 04, 2013 at 03:35 PM 0
Share

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.

avatar image MythN7 · Jul 04, 2013 at 07:11 PM 0
Share

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

game flow concept.jpg (325.0 kB)
avatar image Em3rgency · Jul 04, 2013 at 07:19 PM 1
Share

"" , , {}, [], ()... 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.

avatar image RalphTrickey · Jul 04, 2013 at 07:40 PM 0
Share

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.

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
1

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.

Comment
Add comment · Show 7 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image MythN7 · Jul 04, 2013 at 08:15 PM 0
Share

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.

avatar image Em3rgency · Jul 04, 2013 at 08:18 PM 0
Share

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.

avatar image MythN7 · Jul 04, 2013 at 08:24 PM 0
Share

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 /

avatar image Em3rgency · Jul 04, 2013 at 08:26 PM 0
Share

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?

avatar image MythN7 · Jul 04, 2013 at 08:36 PM 0
Share

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.

Show more comments

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

20 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to make a model appear at a press of a button? 1 Answer

Getting a text to appear when you pick up an items in order? 1 Answer

Passing sender object as an argument in AddListener method 1 Answer

transforming UI button dynamically 0 Answers

How can i make laser switch? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges