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 Robert Meek · Dec 09, 2012 at 12:46 AM · languagecompilers

Back to Basics

Previously my only programming experiance was in Delphi's Object Pascal. Now I also have Delphi's Prism for mono which is C# and is basically equal to the free MonoDevelopment package, as well as Delphi's Prism in Visual Studio 2010 which allows the use of the Oxygene language from RemObjects which is a hybrid Object Pascal editor resulting in what I'm pretty sure is C# NET code. As your application requires C# and I have to either learn that language or use the RemObjects VS 2010 solution, can anyone help me with making the right choice to begin with? Any replies will be greatly appreaciated!


later...

Thanx for the great info! I did not expect so much. But you did not say which compiler/DIE you use. I guess Mono 3.0 or Visual Studio Express 2010 for C# are the only choices I have unless Unity comes with its own. Does it?

Comment
Add comment · Show 1
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 Fattie · Dec 09, 2012 at 12:10 PM 0
Share

Robert, Unity completely comes with its own compiler etc. (use any text editor.)

Completely forget about using any other outside environment.

(it might be possible as an intellectual curiosity but just forget it.)

there's always a confusing discussion about "unityscript versus c#" but the simple fact is you'll need to be comfortable using both.

that's that!

Just download Unity immediately (it's free) and open and start bouncing cubes around. click "add script" and add a line of code to make the cube turn green or whatever.

As B. says you'll have utterly no trouble

it's just trivial, one-thread, scripting in a slightly OO milieu. it's no harder than knocking about with Perl or something (recall the "dot com" era ?!!)

And don't forget, Invoke() is how you make a timer in Unity! :O

1 Reply

· Add your reply
  • Sort: 
avatar image
2

Answer by Bunny83 · Dec 09, 2012 at 01:26 AM

I started myself with Pascal (17 years ago) and moved then to Delphi (around 2000). I never heard of prism or oxygen yet. Sounds interesting but it's not suitable for Unity. While it's possible to create .NET assemblies in any .NET language it's a horrible workflow since you can't test immediately in Unity. You need always to create an assembly and copy it into the Unity project.

I recommend learning C#. It seems you're already a skilled programmer so it shouldn't be that hard to switch. Have you any experience with a C-style language (C, C++, Javascript, ...)? That would simplify the language change. What i found the most irritating when i learned C++ (my switch away from Delphi) was the operator syntax. However most languages that are based on C syntax have the same or almost the same set of operators.

A quick overview:

 operator              Delphi    C#
 assignment            :=        =
 equally               =         ==
 inequally             <>        !=
 logical NOT           not       !
 logical AND           and       &&
 logical OR            or        ||
 bitshift left         shl       <<
 bitshift right        shr       >>
 bitwise AND           and       &
 bitwise OR            or        |
 bitwise XOR           xor       ^
 bitwise NOT           not       ~
 increment             inc(x)    x++    or  ++x
 decrement             dec(x)    x--    or  x--


In C# there are some more operators. For most operators there are combined operators available:

 combined              equals
 x += 5                x = x + 5
 x >>= 2               x = x >> 2
 ...

Another difference is that each statement has also a return type of some kind. Even an assignment has as expression value the value that has been assigned. That's why those things are possible:

 x = y = 5;
 Y = x++;

There are two kinds of increment operators, pre and post increment. As the name says one is executed before the expression value is evaluated the other afterwards.

 int x = 5;
 y = x++;    // y will be 5 x will be 6
 y = ++x;    // y and x will be 7

Variable declarations look like this:

 [access modifier][static] TYPE NAME [= INITVALUE];

[] == optional

C# also supports the var keyword which allows you to omit the type. However when you use it you have to assign an init value to it. This way the compiler can determine the type. This is called type inference.

 var i = 0;   // will be an int-variable

There's actually no difference beteen a function or a procedure. a procedure just have as return type "void".

 void MyProcedure()
 {
     // do something
 }

Calling a function always requires the brackets:

 MyProcedure();

Returning a value from a function is only possible with the return statement:

 int MyFunction(int a, int b)
 {
     return a + b;
 }

In C# you can't declare global functions or variables. This is only possible in a class.

That should be enough to get started ;) Well there's a lot more i could talk about but i'm tired now :D

Comment
Add comment · 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

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

13 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

Related Questions

How is the relationship between Rodrigo Barreto de Oliveira and Unity? 1 Answer

Function to translate text in unity 0 Answers

Where is configuration of launcher window? 1 Answer

unity local language integration problem 2 Answers

Using Conditional Compilers? 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