access static functions from threads

I’m doing some gesture detection with a Kinect camera and then passing the gesture name into this script.

public class databaseMoves : MonoBehaviour {

    public SimpleSQLManager dbManager;


    public void Gesture_Move(string gestureName)
    {
        print ("Gesture_Move" + gestureName);
        Thread threadMove = new Thread (() => Gesture_Move_Thread (gestureName));
       
        threadMove.Start ();

    }

    void Gesture_Move_Thread (string gestureName)
    {
       
        print ("Gesture_Move_Thread");
        string sql = "select sequence.delay, moves.start, moves.steps, moves.direction, moves.motor, moves.speed from moves ";
        sql = sql + "inner join sequence on gesture_sequence.sequence_id = sequence.id ";
        sql = sql + "inner join gesture_sequence on moves.id = sequence.move_id ";
        sql = sql + "where gesture_sequence.name = '" + (string) gestureName + "' ";
        sql = sql + "order by sequence.sequence ASC";
       
        print (sql);
       
        List<Moves> motor_moves = dbManager.Query<Moves>(sql);
        foreach (Moves move in motor_moves)
        {
            print(move.start);
            print (move.steps);
            print (move.direction);
            print (move.motor);
            print (move.speed);
            print (move.delay);
           

            switch(move.motor)
            {
            case 1:
                print ("motor 1");
                motorcontroller.motor1Position ((uint)3200, 1024);
                //motorcontroller.motor1Position ((uint)move.speed, motorcontroller.targetMotor1 (move.steps, move.direction));
                if (move.delay > 0)
                {
                }
                break;

            case 2:
                print ("motor 1");
                motorcontroller.motor2Position ((uint)move.speed, motorcontroller.targetMotor2 (move.steps, move.direction));
                if (move.delay > 0)
                {
                }
                break;
               
            case 3:
                print ("motor 1");
                motorcontroller.motor3Position ((uint)move.speed, motorcontroller.targetMotor3 (move.steps, move.direction));
                if (move.delay > 0)
                {
                }
                break;
            }
        }
    }

}

I then launch a new thread and do a database connection using sqlite and I’m able to see the values in the print(move.*) lines without issue.

move.motor = 1 so case 1 is run and I see the print (“motor 1”) command. For some reason motorcontroller.motor1Position is not running.

In another script called motorcontroller.cs I have this function:

public static void motor1Position(uint speed, int position) {
        print ("motor1position");
        newSpeed1 = speed;
        newMotorPosition1 = position;

        speedChange1 = true;
        positionChange1 = true;
    }

print(“motor1position”) never shows up in the console so I’m assuming the function isn’t being run. Ideas?

Not really sure what I did, but it’s fixed!