"...can only be called from the main thread" - MultiThreading

Here’s my code:

I keep getting this error:

get_transform  can only be called from the main thread.
Constructors and field initializers will be executed from the loading thread when loading a scene.
Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.

The closest you can get to threading with the native unity3d functionality is [coroutines], since Unity isn’t thread safe.
If you know you need to do tasks that take a long time to compute you need to work around these limitations, if you feel you absolutely need to use multithreading. For example you might create a thread that calculates the data and then stores it and flags to the main thread that the data is ready to be processed and then you let the main thread set it.

However for the example you wrote I would probably do the following instead:

void Update () {
    if(Input.GetKey (KeyCode.Space)) {
        Cube.transform.position += transform.right;
    }
}

Since GetKey() returns true as long as the key is pressed then it will do the offset every frame anyway. So there is no reason for threading in your situation.

1