Unity Community


Page 2 of 2 FirstFirst 12
Results 21 to 40 of 40
  1. Volunteer Moderator
    Posts
    23,699
    Quote Originally Posted by TomBrien View Post
    I've made Flash games for like 6 years, and writing C# in Unity
    Use Unityscript (AKA "Javascript"). It's like ActionScript 3.

    If this MonoBehavoir has to be named in the script exactly the same as file is named... then why don't those two things just automatically update each other?
    It does, when you make a C# script it automatically names the class the same as when you first create and enter the script name. You don't need to worry about it when using Unityscript though; in that case the script is automatically a class using the file name and you don't need to specify a class explicitly.

    Or why can't I just write "this" and it knows I'm reffering to the file I'm in?
    You rarely need to use "this". Only if you have global and local variables that are named identically, and you need to distinguish between them.

    --Eric
    SpriteTile: new tile system that works seamlessly with Unity 4.3 sprites
    FlyingText3D: dynamic 3D text with TTF fonts | Vectrosity: fast & easy line drawing
    Nifty utilities! Stitch terrains together - runtime model importing - file browser - fractal landscapes


  2. Location
    Victoria Australia
    Posts
    4,767
    Quote Originally Posted by Eric5h5 View Post
    It does, when you make a C# script it automatically names the class the same as when you first create and enter the script name. You don't need to worry about it when using Unityscript though; in that case the script is automatically a class using the file name and you don't need to specify a class explicitly.
    Is there any reason C# does not do that as well?
    Maybe you can help me work out how to smooth my planetary gravity!


    Quote Originally Posted by hippocoder View Post
    Calm down, you're posting all kinds of nonsense that makes no sense. I suggest you post less, and follow http://unity3d.com/learn tutorials.


  3. Location
    Sooke
    Posts
    3,218
    Quote Originally Posted by titanty View Post
    Is there any reason C# does not do that as well?
    From what I have heard, Unity could do this for C# if they wanted to, so there isn't really a reason.
    -Insert quote here
    ---Famous Person


  4. Posts
    246
    This thread close comes close to giving me an aneurysm in some posts :-/

    Regarding C# vs UnityScript:

    C# is a powerful language used widely in the development world. Unity has very little to do with it, if you are having C# problems, you need to learn the language. No amount of Unity-centric tutorials will teach you C#, and if you do not know the basics of programming, don't expect to be able to just sit down and start making a game with it.

    And regarding semi-colons and C#... ugh. If you know how compilers and programming languages work, you would realize that every programming language has some sort of delimiting character or statement, something, to declare the end of a line of code. A semicolon is the standard for C languages and Java, even Javascript (and probably a lot of others I haven't used).

    If you're truly puzzled about semicolons and why brackets and such exist. Read up on compilers. It's not a "joke. Sure, they could have used other delimiters, but compilers and programming languages are not magic.


  5. Location
    Voorhout, NL
    Posts
    169
    Quote Originally Posted by OmniverseProductions View Post
    I read somewhere recently (I want to say on the Boo website or in a boo book) that the whole semicolon at the end of a line thing was actually a joke a programmer made when developing a language. When he joked about it, people took him seriously and added it.
    that is actually true. In early languages you had to use a semicolon to mark that this code-line would continue on the next physical line. Someone at microsoft then thought it funny to do that the other way around.
    Currently working on: Some small project.

    Add me to skype: dterbeest


  6. Location
    Virginia, USA
    Posts
    1,372
    Who needs List()[0] anyway? Use C#!

    I started with Javascript, but switched to C3 for my 2nd project. The switch was much easier than I expected. Then I found a whole bunch of C# cause Mono is so widespread. But most importantly, Javascript was a huge pain in the rump when I started using plugins and deligates and stuff like that. Ugh! I should have just started with C#.

    Gigi.
    What Went Well - a Meditation on Gratitude and Happiness
    Good Sex, Great Marriage - Still The #1 Marriage App on iOS *** Also on Android!
    The Gratitude Habit - 1000 5-star reviews

    The Secret of Success? Try; Improve; Repeat- 'till too good to ignore.


  7. Posts
    79
    I wasn't bad-mouthing C# or anything, I'm just saying code is super hard to learn so don't freak out.

    The way I've bin doing it up until now I could type like an uneducated goof and the game would play without blinking. Learning this again from the beginning though, there's like a hundred points in that line that would've refused to even test. So learning a scripting language is impenetrable and unforgiving, but you're not the first person to say that, so don't feel like an idiot.

    But yeah, "ugh... If you already knew how this worked you wouldn't all be giving me such a headache right now" is a pretty good attitude aswel, so that's cool.
    Last edited by TomBrien; 04-30-2012 at 12:10 PM.


  8. Location
    Montréal Quebec
    Posts
    2,235
    Quote Originally Posted by Torsh View Post
    I come from using Scirra Construct and my years using it. It had its difficulties, such as copying&pasting long codes being cumbersome, but 90% of the time things worked right...
    Read yourself up:
    "Copy and pasting long codes..."
    That's not the way to learn programming. You wont get too far like that.
    That's the reason for your thread right?
    Forgotten Memories Teaser
    Forgotten Memories Trailer
    I write shaders for the community!
    Dead Strike iOS (Top iOS game made with Unity).
    Nintendo Wii U and Sony (PS3/PS4/Vita) Licensed Developer/Publisher.
    __________________________________________________
    Georges Paz
    http://www.forgottenmemoriesthegame.com


  9. Posts
    553
    Quote Originally Posted by tatoforever View Post
    Read yourself up:
    "Copy and pasting long codes..."
    That's not the way to learn programming. You wont get too far like that.
    That's the reason for your thread right?
    Um, no. I meant copying & pasting my own drag-and-drop codes. But thanks.

  10. Volunteer Moderator
    Location
    Up there, in the sky!
    Posts
    1,729
    Programming is about describing behaviour.

    The more flexible your system, the more different ways it *could* behave - so the more precise you need to be to capture exactly which *one* way you want.


  11. Location
    NSW australia
    Posts
    4
    Quote Originally Posted by Moraleidahgo View Post
    But that moment, when I saw my game running and someone having fun with it, was one of the prettiest moments of my life. That moment I decided I would make a living out of creating games, make a living out of entertaining people. That moment made it all worth it.
    That was really inspiring to read, thanks man. I will.


  12. Location
    UK
    Posts
    1,899
    Quote Originally Posted by Superpig View Post
    Programming is about describing behaviour.

    The more flexible your system, the more different ways it *could* behave - so the more precise you need to be to capture exactly which *one* way you want.
    Then there are the simple behaviours/rules you can add to things that can create some amazing results, e.g. just setting up a NPC to try and stay at a min distance away from others and then move them around and you get flocking behaviour.

    *These videos are the most visually striking versions I can find don't be put off by them they all use very simple rules at their core they are just to indicate what simple behaviours/rules can create.



    Also there are cellular automaton and fractals two systems that use simple rules to create amazing results.





    My point is sometimes with simple rules you can get amazing results.

    Another example would be Minecrafts landscape it uses a 'noise' function (perlin or simplex probably).

  13. Volunteer Moderator
    Location
    Up there, in the sky!
    Posts
    1,729
    Quote Originally Posted by Arowx View Post
    My point is sometimes with simple rules you can get amazing results.
    Sure, emergent systems are very powerful. However:

    1) They're unpredictable, which is somewhat at odds with trying to create a carefully sculpted gameplay experience. (Sometimes you aren't trying to do that. That Minecraft is full of unpredictable little weird situations is part of its selling point).

    2) It's quite difficult to come up with those simple rules in the first place.

    A lot of the time, emergent systems are just a form of compression: you know that you want your landscape to have these features and properties and not those features and properties and so you cook up a noise function with the features and properties you want. But you still have to have an understanding of what features and properties you want in the first place.


  14. Location
    UK
    Posts
    1,899
    I think it depends on what your aiming for:

    If you want an 'on rails' carefully crafted gameplay experience they are. But you will need the time / people resources to tailor that experience.

    Whereas a procedurally generated system could create a new experience/world every time and with the right safeguards could avoid the obvious pitfalls of dropping the player into a pit or horde of enemy npcs to start with.

    The simple rules are already well understood and used for a lot of systems, conways game of life, noise functions and fractals have been explored in some depth and already adapted to games.

    But remember there is the fact that the game you are making is a set of simple rules, and when your developing it expect it to surprise you only we call these emergent behaviours 'bugs', although sometimes you get a WOW moment when your system will do something cool or quirky.

    http://blogs.unity3d.com/2012/04/02/...-usergroup-10/


  15. Location
    Lazio, Italy
    Posts
    678
    Quote Originally Posted by dterbeest View Post
    that is actually true. In early languages you had to use a semicolon to mark that this code-line would continue on the next physical line. Someone at microsoft then thought it funny to do that the other way around.
    Er, no. Not even close. The semicolon was used as a statement end marker for the original C programming language (and its immediate predecessors) because compilers were dumb as a box of bricks back in the very early 1970s. Microsoft didn't even exist at that time.

    The C programming language was designed to be a portable assembly language. (Assembly languages are just one step up from the CPU's native language, known as "machine code".) As every CPU family has a different machine code and assembly language, C was a godsend for creating early operating systems like Unix: it meant you only had to write everything once, instead of rewriting everything from scratch in a different assembly language for each manufacturer's CPU.

    The C language was very simple, so a quick and dirty compiler could be written very easily. This is the reason for all that cruel and unusual punctuation: the curly braces mark the start and end of a block of code and define variable scope; square brackets mark array indices; semicolons spotting where a program statement ends a piece of cake. All this makes writing that compiler—which must be done in the native assembly language for a new CPU architecture—a walk in the park. Such compilers also tend to be very small.

    Once you have that initial compiler, you can then use it to compile a more powerful, more complex, compiler already written in C. This compiler will include optimisation tricks and other fancy features that the original, basic compiler does not, so you then use that compiler to recompile itself in a more optimised form. And that's the compiler everyone then gets to use on the sparkly, shiny, new CPU architecture.

    So there is a reason why C looks the way it does.

    The C programming language proved so popular—it's the language that underlies the entire Cult of Unix as it was specifically designed to help create Unix in the first place—that it has spawned a whole ton of bastard children. C++ and Objective-C are the oldest of those children, and the most closely related: you can write valid C code in either and it will run. Crucially, they could be built using a standard C compiler with some additional layers nailed on, saving a lot of time.

    Java and C# are more distantly related: they share much of the C syntax—all those braces, the requirement for semicolons, and so on—but have one crucial difference: they don't get compiled directly into the computer's native language. They get compiled into intermediate languages which are then compiled at the last minute (known as "Just-In-Time compilation") to produce the final machine code. (Java does not require this final compilation phase: some Java implementations simply translate Java code line-by-line. This is not the case with C# and Unity, which always compile the program into assembly language before it is actually run.)

    In Java's case, that intermediate language is used almost exclusively by Java programs. Microsoft—a company that began life developing programming tools, not operating systems—felt this was a mistake and created their ".NET" technology in 2000. .NET includes an intermediate language suitable for multiple programming languages, including C#, Boo and even Javascript. The "Mono" technology that sits beneath Unity is simply an Open Source port of Microsoft's .NET.

    More recently, the GCC compiler suite used in GNU / Linux and other Open Source environments has been rewritten to use its own intermediate language. This is called "LLVM", and it is used by Apple's own Xcode development tools. Thus the programming world is very slowly moving away from old-school programming language compilers such as the C compiler of old.

    Unfortunately, those changes haven't been reflected in the choice of mainstream programming languages available to us. Of the three supported languages in Unity, two—C# and Javascript—are related to that decades-old C programming language. Boo takes its design cues from Python and is relatively free of those braces and semicolons, so users who have trouble with C# may want to try it.
    Last edited by stimarco; 05-01-2012 at 02:22 PM.
    Sean Baggaley

    Author of "Tic-Tac-Tut" turn-based game tutorial. Get it from the Asset Store here! (Tic-Tac-Toe game with illustrated 40-page documentation.)

    "Tic-Tac-Tut" turn-based game tutorial support thread.


  16. Location
    Ryazan, Russia
    Posts
    780
    Quote Originally Posted by TomBrien View Post
    There's no assistance or help or clues built into it anywhere to help you get started, it's just a blank text doc!
    I keep getting errors because I didn't put the semi-colon in to note a new line, or I didn't put a space somewhere, or I set a variable and then didn't use it- all things that would casually automatically clean themselves up in Flash.
    MonoDevelop: http://forum.unity3d.com/attachment....7&d=1324508362
    Visual Studio: http://forum.unity3d.com/attachment....5&d=1324507954

    MonoDevelop: http://forum.unity3d.com/attachment....4&d=1334346422
    Visual Studio: http://forum.unity3d.com/attachment....9&d=1334351651

    Visual Studio Express is bit less integrated with Unity, but is still more friendly IDE than MonoDevelop. It highlights syntactic and semantic errors. Auto-completion works always in contrast to MD. You place cursor on an identifier or a keyword, press F1, and see MSDN page about it. It just feels more comfortable.

    Quote Originally Posted by TomBrien View Post
    The way I've bin doing it up until now I could type like an uneducated goof
    I write almost like that in Visual Studio. "Almost" because I don't write all the code, half or 2/3 of it is actually written by auto-completion, not me. When I write code, I think about the idea I'm implementing, not about how to implement it or how to write the code properly. Visual Studio helps me a lot.


  17. Posts
    439
    MonoDevelop actually makes me learn some good coding habits, as it doesn't do the work for me (semilocons, autocomplete, etc). Maybe a more experienced user can benefit from the faster IDE, but a noobie can learn a lot with a simpler tool
    Looking for helpfull hands with an action/RPG fan game -- link
    Remember to have a nice day and smile!


  18. Location
    Ryazan, Russia
    Posts
    780
    Quote Originally Posted by Zethariel View Post
    MonoDevelop actually makes me learn some good coding habits, as it doesn't do the work for me (semilocons, autocomplete, etc).
    Could you elaborate? Auto-completion not only saves keystrokes and increases keyboard lifetime, it also shows the stuff you would never know it existed, and encourages to explore it. Just like "tip of the day", but more frequent and less annoying. By the way, Vector3.left, Vector3.back, Vector3.down are still undocumented, but I was aware of them right from the moment I typed "Vector3." for the first time.


  19. Location
    asia
    Posts
    72
    You think game making is hard? mmhh... for me its pure fun


  20. Location
    Deepest, Darkest Alaska
    Posts
    861
    More often than not, Monodevelop ignores the names I want and inserts something irrelevant, so if I forget to hit esc I have to backspace and type what I actually wanted. This does introduce me to new constructs, however

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •