addComponent c# script by java
hello there. trying to add c# script as component in java script
 #pragma strict
 public var obj : GameObject;
 public var mono : MonoBehaviour;
 
 function EnableFu**ingC ()
 {
     
     obj = gameObject.Find("TextPicRus");
     mono = UnityEngineInternal.APIUpdaterRuntimeServices.AddComponent(obj, "Assets/Plugins/JS/enableC.js(15,16)", "Translate");
 }
this code is working, but only in Unity. if build to any platform, i have an errors
 Assets/Plugins/JS/enableC.js(18,62): BCE0144: 'UnityEngineInternal.APIUpdaterRuntimeServices.AddComponent(UnityEngine.GameObject, String, String)' is obsolete. Method is not meant to be used at runtime. Please, replace this call with GameObject.AddComponent<T>()/GameObject.AddComponent(Type).
 Error building Player because scripts had compiler errors
tried
private var Translate : Translate;
mono = obj.AddComponent(Translate);
mono = obj.AddComponent("Translate");
mono = obj.AddComponent<"Translate">();
mono = obj.AddComponent(); 
nothing works. any ideas?..
Not sure about javascript. Does this work? mono = obj.AddComponent(typeof(Translate)) Just a guess really. Is that c# code really complex? $$anonymous$$aybe you're better off translating it to js yourself. 
thanks! you are lifesaver!)) its just mono = obj.AddComponent(typeof("Translate"));
well, ok, its building... but component is not added to gameObject... if i try mono = obj.AddComponent(typeof("Translate"));
 AddComponent asking for "String" which is not a Unity engine type.
 UnityEngine.GameObject:AddComponent(Type)
 enableC:EnableFu***ngC() (at Assets/Plugins/JS/enableC.js:17)
if i try mono = obj.AddComponent(typeof(Translate)); (without quotes)
 Assets/Plugins/JS/enableC.js(17,44): BCE0005: $$anonymous$$ identifier: 'Translate'.
and c# code is too complex for me to be rewritten in java
Are you sure the c# script inherits monobehaviour?
Your answer
 
 
             Follow this Question
Related Questions
C# - JS problem. 1 Answer
Need help to put together 2 scripts 0 Answers
How do I make a enter and exit car script? 0 Answers
Health Script 2 Answers
Could someone translate these to c#? 1 Answer
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                