I already have a script for the drag event(MouseRotateBullet, MouseRotateBarrel, and RotateBullet) but my problem is every where in the field i click and drag the object drags. I want to make a game object that will trigger the action of this scripts. That whenever i click and drag that object that’s the time when the barrel will move not affecting the whole field. I already have a script for calling those scripts
var obja = GameObject.Find("GunBarrel");
var scripta = obja.GetComponent("MouseRotateBarrel");
scripta.Update();
var objb = GameObject.Find("Cube");
var scriptb = objb.GetComponent("MouseRotateBullet");
scriptb.Update();
var scriptc = objb.GetComponent("RotateBullet");
scriptc.Update();
my only problem is what event am i going to use this codes and how am i supposed to do that and put it in an empty game object.