converting javascript to c#

can anyone please help me convert this one. thanks :slight_smile:

		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();

Not sure why you are calling Update on these scripts… Update gets called every fram regardless? Also note that your current method will only handle one object of each type… but if you want a direct translation… This is untested but should be about right.

gameObject obja = GameObject.Find("GunBarrel");
MouseRotateBarrel scripta = obja.GetComponent("MouseRotateBarrel");
scripta.Update();

gameObject objb = GameObject.Find("Cube");
MouseRotateBarrel scriptb = objb.GetComponent("MouseRotateBullet");
scriptb.Update();

RotateBullet objc = objb.GetComponent("RotateBullet");
scriptc.Update();