Add script with AddComponent in JavaScript

//HOW CAN I FIX IT? THE ERROR IS IN THE 7th LINE OF CODES

public var script : MonoScript;
public var objs : GameObject[];

function Start(){
	objs = FindObjectsOfType(GameObject) as GameObject[];
	for(var i:int; i<objs.length; i++){
		if(objs*.GetComponent.<ParticleSystem>()!=null){*

_ objs*.AddComponent.();// <---------------- !!! THE ERROR IS HERE !!!_
_
}_
_
}_
_
}*_

And the error is...?

–

1 Answer

1

That’s not how you use AddComponent in UnityScript. You tried to do it in C#.
Check the API:

objs*.AddComponent("name_of_component");*