call script to another script

hello
i have this problem i want to call 1 function in my scrip1 since script2 but BUG NullReference
please someone can help me

thanks

First class:
public class Unit : MonoBehaviour {



void GetOrder()
{

}
}

Second class:
public partial class InputController : Unit{



void dest()
{
var ScriptUnit = GetComponent(); >>>>>>NullReferenceException
if(ScriptUnit.GetOrdre())

}
}

The Reason why you get a null referance is becaurse gameobject where InputController is residing doesnt have a component of type Unit. Seems like you need to save a referance ot Unit in Inputcontroller

public class InputController {
public Unit unitFromOtherGameObject;
}

Drag a referance to the Unit instance/gameobject over to the referance inthe InputController gameobject - in the inspector - and do this instead

var ScriptUnit = unitFromOtherGameObject ← this is no longer a null referance…

im sorry but i m beginner and i don t know how can do it