Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

why unity3d supports several scripts?

Discussion in 'General Discussion' started by tinysrc, Jul 10, 2012.

  1. tinysrc

    tinysrc

    Joined:
    Jul 10, 2012
    Posts:
    3
    it's chaos when several scirpts coexist, i think.
    the real hard is writing plugins for extend, not learn such a high-level language.
    keep it simple and stupid plz.
     
  2. yuriythebest

    yuriythebest

    Joined:
    Nov 21, 2009
    Posts:
    1,023
    I'm gonna assume you meant scripting languages - scripts by themselves can get along quite fine- I've had a project with tens of scripts and it worked fine!

    so people can choose the scripting language

    yeah it's best to keep to 1 language

    yeah but you MUST!

    no thx I'll keep it complicated but very tidy and smart
     
  3. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,602
    Its no chaos with several script languages cause the language doesn't matter in the end, it all goes to Mono .NET CIL and can all interoperate with anything 3rd party devs have written in any of the languages if it was done correctly
     
  4. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,702
    I don't mind it... most examples etc are in UnityScript which I am comfortable with. Haven't tried C# ... seems more `programmer-y`? .... I would prefer Unity implement a language based on BASIC with types, e.g. BlitzMax. Much easier to write code.
     
  5. echtolion

    echtolion

    Joined:
    Jun 16, 2011
    Posts:
    135
    It's as simple as you want it to be, all .NET/mono languages will compile down to the same IL code and work fine together.

    Unityscript is a great language for beginners.

    .. I wonder how many people actually use boo...
     
  6. tinysrc

    tinysrc

    Joined:
    Jul 10, 2012
    Posts:
    3
    so people can choose the scripting language
    why people need choice? affinity for all kinds of scripting users? the only reason.
    no thx I'll keep it complicated but very tidy and smart
    thx for ur hard work.
     
  7. Foam

    Foam

    Joined:
    Jun 13, 2012
    Posts:
    322
    UnityScript and Boo are pretty forgiving languages. If you have problems with those then you're not really going to find it any easier anywhere else to write code and need to go back to the basics of programming if you want to resolve your issues. Perhaps with something far less complicated than a 3D engine.

    As far as why people need choice in their languages, well, not only is every programmer different but each problem they are trying to solve is different. Different situations call for different tools. The languages may all be the same in that they're Turing-complete, but, some are hugely easier to use depending on what you're trying to accomplish.
     
  8. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,602
    Thats why I would like to see UnityScript and Boo gone for the integration of IronPython or IronRuby. They are non programmer friendly and support stuff that makes sense to non programmers (duck typing etc) where as programmers can and will keep using C# and that without these languages lacking crucial core features (unlike UnityScript thats not even capable of properly operating with events)

    Basic is nice but the documentation problem on it would be equal to UnityScript and Boo and hence not make sense to exist. Unless I missed a big widely used .NET based Basic syntax that wouldn't suffer this
     
  9. tinysrc

    tinysrc

    Joined:
    Jul 10, 2012
    Posts:
    3
    maybe u are right.thx
     
  10. echtolion

    echtolion

    Joined:
    Jun 16, 2011
    Posts:
    135
    Having a choice in languages is one of the features of mono, not one of the downsides.
     
  11. Alex Cruba

    Alex Cruba

    Joined:
    Aug 16, 2011
    Posts:
    564
    Is there any problem about the "ability" of several languages? I'm german, speak also english (some people say good, some people say bad), I wanna learn greek language and also french. Maybe aliens have to stick to one language...

    Just open Unity, open MonoDevelop and code the language you like.

    Dam... Right now aliens infront of my house forced me to speak at intergalactic court to say sorry for telling you they would just stick to one language... My bad...
     
    Last edited: Jul 10, 2012
  12. gfoot

    gfoot

    Joined:
    Jan 5, 2011
    Posts:
    550
    I think you can use Basic if you want to, via Visual Studio building a DLL. This kind of thing works fine:

    Code (csharp):
    1.  
    2. Imports UnityEngine
    3.  
    4. Public Class UnityTest
    5.     Inherits MonoBehaviour
    6.  
    7.     Public Sub Update()
    8.         transform.position = transform.position + Math.Sin(Time.realtimeSinceStartup) * transform.up
    9.     End Sub
    10. End Class
    11.  
    I guess Unity could easily support it natively, but failing that you'd need a (pro-only) asset postprocessor to automatically rebuild the DLL whenever a .vb file within the assets folder changes. Easy to write as an editor extension, though the chances of a pro user wanting to use Visual Basic seem rather slim!
     
  13. stimarco

    stimarco

    Joined:
    Oct 17, 2007
    Posts:
    721
    Not quite. C# is very popular among developers who come from Windows and XNA (XBox) development. By supporting C#, they can just jump right in and get going very quickly with Unity.

    Similarly, UnityScript (which is very closely related to ECMAScript / Javascript) has a strong following among people who come from a web development background as ECMAScript is supported by every good web browser. And quite a few crap ones too.

    Boo has a number of features not found in C# and Javascript, including the ability to extend the language itself. This ability makes it very useful for things like Unity Editor extensions and plugins. Unlike ECMAScript and C#, Boo has evolved from Python and similar languages, rather than the older "C" family of programming languages, so you also don't have to remember to stick semicolons and curly braces everywhere.

    When you need a screwdriver, you don't pull a hammer out of your toolbox. Similarly, when you need to write a high-performance driver for a graphics card, you're unlikely to choose to write it in COBOL or MUMPS.

    You pick whatever tool fits your needs best. The more programming languages you learn, the better you will become at programming. There is no such thing as a "best programming language".
     
  14. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,242
    Unityscript is actually a lot more similar to ActionScript3, so it gets Flash users. Pure web Javascript users tend to be confused at first since it's not actually that much like Javascript (no prototype etc.).

    --Eric
     
  15. SevenBits

    SevenBits

    Joined:
    Dec 26, 2011
    Posts:
    1,953
    I disagree. It'll make Unity look too childish. BASIC teaches you to write bad code, which is why I never use it nor learned it.
     
  16. SevenBits

    SevenBits

    Joined:
    Dec 26, 2011
    Posts:
    1,953
    Actually, that's an interesting idea. Something for newbies maybe.

    Although I do agree that if you're going to purchase a $1500 engine, you'd better know something more advanced than BASIC.
     
  17. taumel

    taumel

    Joined:
    Jun 9, 2005
    Posts:
    5,293
    I wonder if you realise to a certain degree how stupid the things you said are.
     
  18. stimarco

    stimarco

    Joined:
    Oct 17, 2007
    Posts:
    721
    BASIC teaches you nothing of the kind. BASIC is a family* of related programming languages and, like every other programming language, it is the programmer who writes bad code. A programming language is just a language: a medium of expression. What you choose to express in that medium is entirely your responsibility. If you hit your thumb with a hammer, the hammer is not to blame.

    You can write some incredibly dangerous, truly horrific, code in C++ than you can in most versions of BASIC. The C++ programming language is famous for letting a bad programmer blow their entire leg off, not just their foot. When wielded by experts, however, C++ can do amazing things—it's what Unity is mostly written in, for example. But I've seen spectacularly bad code written in a veritable Babel of programming languages. This being the Internet, it won't surprise you to discover that there's even a website dedicated to such coding horrors.

    Every tool has a context for which it was designed. BASIC was never intended for use in mainstream application development: it was intended as a teaching tool first and foremost, but has also found favour in businesses as a scripting language for customising and gluing multiple applications together to improve business processes. BASIC does such jobs very well. Like many programmers of my generation, my first programming language was Sinclair BASIC on the ZX81. I've rarely used Visual Basic in any of its forms, but I've worked with VBA a fair few times to build simple MS Access databases. There's nothing inherent in its design that forces you to write bad code.


    * (Unlike many other programming languages, there has never been any kind of official "standard" for BASIC. Visual Basic bears almost no resemblance to the earlier, explicitly line-numbered, BASICs found in the home computers of the early '80s, for example.)
     
  19. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    12,799
    Huh?
     
  20. ZeroByteDNA

    ZeroByteDNA

    Joined:
    Jun 18, 2012
    Posts:
    1,042
    There is too much BASIC hate in this thread.

    Commodore PET, Commodore Vic20, Commodore C64, Commodore Plus/4, Commodore 128, Apple II/IIe/IIc, Coleco Adam, PC/PC XT/PC AT, etc, etc, etc...

    Sure, I may have dorked around with Turbo C++ in the early 90s, but I soon made the move to VB in the early 90s as well. Before starting to step away from VB to C# with VS.NET, I also spent time with FoxPro and Delphi.

    Some form of BASIC: 26 years
    Some form of C++: 4 years
    Delphi: 2 years
    FoxPro: 2 years
    C#: 8-9 years
    Others: blah, blah, blah

    I have a great fondness for BASIC...even though I haven't touched it in almost 5 years, heh. I know the C/C++ guys have always looked down on the BASIC guys. Heck, even the Pascal folks back in the mid 80s looked down on the BASIC guys.

    I find it ludicrous to suggest that BASIC teaches you to write bad code. While I'd recommend C# over say VB these days, that's more about the potential application of the language than the language itself. Which goes along with what stimarco said about intended use and that anybody can be taught to code poorly regardless of the language.

    Oh well, fuddy duddy rant over...
     
  21. CanOfColliders

    CanOfColliders

    Joined:
    Oct 27, 2011
    Posts:
    23
    I like the choices a lot as well, and think its also a part of the reason Unity is where it is right now.
    If it wasn't for c#, i probably wouldn't have tried unity back then, and i'm sure theres a lot of people who came to unity only because they noticed US looks familiar to them, or they preferred to work in python and were interested with boo because of that.

    I mean you can learn another language pretty fast, i've worked on projects with people using unityscript by now and didn't have any problems getting into it, but if i knew from the beginning unity only supported unityscript, i probably would have never tried it at all.

    The 3 languages do a great job offering people something they know already or something close to languages they're familiar with, so it eventually brings more people to picking up unity.


    tl;dr
    unity should replace all languages with lolcode http://en.wikipedia.org/wiki/LOLCODE nao! ;)
     
  22. ZeroByteDNA

    ZeroByteDNA

    Joined:
    Jun 18, 2012
    Posts:
    1,042
    Ouch, lol - I teared up laughing at that one.

    It's kind of scary, but I could see Microsoft's FUSE doing something like that as the next version of Kodu...meh.
     
  23. gfoot

    gfoot

    Joined:
    Jan 5, 2011
    Posts:
    550
    Well, modern Visual Basic is structurally so similar to C# etc that I don't think it makes sense to say it encourages you to write bad code - while that point may stand for older dialects. MS take VB seriously, because they have a large userbase of developers working in an environment with high developer turnover. Their code will last a long time, and change hands orders of magnitude more frequently than game code for example. Maintainability is very important there.

    As a language, I'm no expert on it, but it seems to have almost all of the key features of C#. The biggest divergence is probably the case-insensitivity, and this is the area where Unity may fare badly - Unity's API, in places, is careless with case. So in a method of a MonoBehaviour-derived type, 'gameObject' and 'GameObject' both resolve to the former - the property accessor in the component - whereas in C# the latter would fall back to the type imported from UnityEngine. This is not inconvenient in this case - VS (or maybe ReSharper) corrects the case as you type, and all the static members of GameObject are available via gameObject, presumably without bothering to actually call the property accessor - but I don't know whether there are other cases where this case-sensitive shadowing would cause problems.

    In the end I think it's a matter of taste, and readability which is often subjective anyway. The only language which seems different in this respect is UnityScript, because it appears to have some Unity-specific features - like every file automatically defining a class which inherits MonoBehaviour, so you don't have to bother with that.
     
  24. ZeroByteDNA

    ZeroByteDNA

    Joined:
    Jun 18, 2012
    Posts:
    1,042
    Allows would definitely have been the better word - rather than encourages. It's the coder, not the language.

    Heck, take two coders using Unity Script. Slap #pragma strict in there - one of them might suddenly have issues while the other is fine.

    You can see this with some of the tutorials out there. Unity's thrown #pragma in, so the tutorial code throws a fit.

    Case sensitivity, typing, etc - they are things that different coders are going to do differently - unless their language provides the crutches that does not allow them to do so. It's not that they're inherently better coders, it's that they're using a language with a safety net that does not allow them to do certain things. Compare that to the coder that plays without the safety net while not doing those things - which would be the stronger coder?

    So yep, I would say allows is better than encourages. The crutches aren't there...
     
unityunity