in scripting api page, I see those word UnityEngine.Advertisements , UnityEngine.AI . what are they call them? in each UnityEngine.xxx , have Classes and Enumerations , what is that? Why other UnityEngine.xxx have more CATEGORIES than Classes? . Please see http://imgur.com/a/ynK0i . In Classes, Enumerations, what are those words? what do they call them? How to use them in programming? Is I have to remember all ? how to LEARN TO USE them? How those words in Classes and Enumerations working? HOW UNITY API WORK? HOW UNITY API RELATION TO C# LANGUAGE IN PROGRAMMING? Those categories at last see some different. What is Classes and Enumerations AT LAST? what are those words in OTHER categories? How to use them? what is unity editor? what different between UnityEditor and UnityEngine? how to use unity editor?
The scripting API is divided up, hierarchically, into:
-
Namespaces (such as UnityEngine, UnityEngine.Networking, UnityEngine.UI, etc.) that provide access to classes written by the Unity developers. You gain access to these namespaces with
using UnityEngine;
-like directives at the top of your scripts. -
Each namespace contains a collection of C# Classes that provide functionality. For example, if you want to access a Text Component of an object via code, that code would need a
using UnityEngine.UI;
directive at the top. -
Each class’ Members arelisted on their respective class’ pages (the long list on
Text
API page). You will need to either learn, or be able to look up, a class’ members in order to use that class. -
Global classes, types, and generally other “stuff” that doesn’t belong to the namespaces.
There are TONS of tutorials available from Unity and on YouTube to help you learn programming in Unity.
I’d highly recommend learning a little about programming in C# (or javascript, if you’d prefer) outside of Unity before you jump in. Writing software is hard enough. Games even more so. You owe it to yourself to learn it the right way, rather than just copy-paste a game together.
Some more resources I use/used:
Please buy a programming book!!!
because nobody will explain here the fuctionallity of C#
Unity Engine and Editor, that are all namespaces!
To write a script that you can use in Unity you need to Implement using UnityEngine;
If you want to make a Editor Application use using UnityEditor;
UnityEngine.transform is the xyz position, rotation,scale…
Thats so much, buy a good book about C#
regards, T
You are stressing your self over nothing, no need to use caps
LMGTFY - Let Me Google That For You
I suggest you start here
https://unity3d.com/learn/tutorials
The UFO tutorial is the one I started with, if you feel like doing 3D then look into the 3D stuff, get a feeling and a grip over unity then start making your dreams come true!
First google, Unity tutorial links from there.
Second google, Unity questions from there.
Third you try
and then at last ask here! (:
make your question direct and iam sure someone will come to aid you!
questions you are asking I honestly don’t know the answers to them though I can definitly speculate
I just find them rather pointless to be concerning your self with that instead of actual how to do this and that stuff (:
although iam sure you will know the answer to your questions as you learn. don’t get ahead of your self
learn first from scratch then ask these questions!
oh and by the way, unity Engine is an IDE (devolpment enveriment) you could make games using a note pad but these things make it O so much easier. There are alot of IDEs out there that do the same stuff unity does AKA simplify things, but unity is good because its in C# which is relatively easier to use as well as its many many platform support, unity is just good and does it right. at least that is according to my limited info
Have a great day!
Hi @james82, the problem is that your question is vague but I will try my best to answer. The way Unity and C# interacts is through a Class called MonoBehaviour. Let me explain: When you first start programming with the C# language you will without a doubt seen a function as follow:
public static void Main (string[] args) {
While (true) {
// Main loop of the game
PlayGame (); // Example Function
}
}
This is the code usually created to start a program and then inside the while loop, or the main loop all the functionality for your game will be handled (this is common practice when writing a game from scratch). In Unity, this code (as well as allot of other code like physics and rendering) is hidden to the programmer so we do not have to worry about it and only focus on creating the game.
However, and this is where C# and unity connect, within the main loop of the game, the C# program searches for all the classes that extends/implments the MonoBehavior class and calls all the functions related to the Unity API inside all these classes. You do not actually have to call them yourself Unity Handles it for you.
This also allows scripts to be added to Game Objects within the game. When you try to add a script/behaviour that does not extend MonoBehavior to an Object/Transform in game , you will get an error. That is why when you create a new script the MonoBehavior function will also be added, see example below:
using UnityEngine;
using UnityEditor;
using System;
public class MyClassA : MonoBehaviour {
// Rest if the class
}
Now within MonoBehaviour there are several inbuilt functions as mentioned. These functions get called according to predefined conditions, we cannot control these conditions, they are inbuilt. Some of the most common functions you will come across is:
- Update
- Start
- Awake
- LateUpdate
- OnCollisionEnter
- OnTriggerEnter
And many more. For a full list you can view the unity API here. Within this list it explains what each functions does and when it is called. Now within the list provided there are also public functions that are not called by the backend on each frame or events like the above functions. These are rather called by you the programmer. Some examples are:
- GetComponent
- StartCoroutine
- Destroy
Lastly there are also variables part of MonoBehavior that can be referenced:
- transform
- tag
- name
So as a summery of the above, the backend of Unity searches for all the classes that extends MonoBehavior and calls certain functions in each that is listed in the Unity API. Monobehaviour also adds certain variables and public functions to those classes that make it easier for us to reference and use. Scripts/behaviours attached to in game objects/transforms needs to extend the MonoBehavior class. We can call non MonoBehavior classes within a MonoBehavior script. They just can’t be attached to objects.
Lastly, MonoBehavior is a big class that can make use of other namespaces (A namespace can be seen as a collection of classes). We increase its functionality by including other namespaces, example:
using UnityEngine.AI;
using UnityEngine.Audio;
using UnityEditor.UI;
I Hope this helps!!