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.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?
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.Or why can't I just write "this" and it knows I'm reffering to the file I'm in?
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
Is there any reason C# does not do that as well?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.
-Insert quote here
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.
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.
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.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.
Currently working on: A city building game. I need a lot of help in the arts department, so please contact me!
Need help? Add me to skype: dterbeest
Who needs List() anyway? Use C#!
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 01:10 PM.
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 any shader for the community!
Dead Strike iOS (Top iOS game made with Unity).
Nintendo Wii U and Sony (PS3/PS4/Vita) Licensed Developer/Publisher.
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).
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.
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.
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.)
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.
MonoDevelop: http://forum.unity3d.com/attachment....7&d=1324508362There'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.
Visual Studio: http://forum.unity3d.com/attachment....5&d=1324507954
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.
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!
You think game making is hard? mmhh... for me its pure fun