The first tutorials that I’ve looked through use components for verything.
I come from gamemaker studio, and I have plenty of experience in Java, Python, SQL databases etc.
In gamemaker, I can create an object, and ignore their “drag and drop” for the sake of my own code.
Through this code I can just check if a key is pressed, and then change the object’s position.
How would I be able to do this with scripting alone?
This may be a misjudgement… but is Unity made primarily for working with components, and second for scripting/coding?
Is there anything better than the reference scripting API ?
I mean if I search “movement”, I need to wait for 5 seconds, or more, and then I just don’t find what I need…
Unity uses the composite design pattern heavily. Each GameObject is basically just a container that holds a bunch of components. The components are where all of the magic happens.
There are a huge number of build in components. These are primarily for accessing Unity’s build in systems. Want to access the physics library, then use the Rigidbody and Collider components. Want to access the UI system, then use the Canvas and Button components. Redering uses Mesh and Renderer components. And so on.
But don’t let the vast number of built in components fool you. Unity doesn’t write your game for you. Most of your coding time will be spent writing your own components. These can get as complicated as you like. You have the full power of .NET and C# at your finger tips.
Create this component and add it to an empty GameObject.
public class MoveOnKey : MonoBehaviour {
[SerialiseFeild]
int speed = 5;
void Update () {
if(Input.GetKey(KeyCode.Space)){
transform.potion += Vector3.up * speed * Time.deltaTime;
}
}
}
It only gets more complex from here. Unity lets you code as much as you like. And components are how you use that code in a practical fashion.