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()/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?..
↧