Question by
taher1 · Jan 09, 2018 at 11:13 AM ·
error build
error CS0619: `UnityEngineInternal.APIUpdaterRuntimeServices.AddComponent(UnityEngine.GameObject, string, string)' is obsolete:
Assets/DB/Scripts/GamePlay/Quest/Base/PlayerQuestManager.cs(46,51): error CS0619: 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).' when i am trying to build this error showing. (this error showing)
public void LoadQuests (string name)
{
string[] questList = PlayerPrefs.GetString ("QUEST_" + name).Split ("|" [0]);
Quests.Clear();
for (int i=0; i<questList.Length; i++) {
if (questList [i] != "") {
Debug.Log ("Add quest " + questList [i]);
GameObject obj = new GameObject(questList [i]);
UnityEngineInternal.APIUpdaterRuntimeServices.AddComponent (obj, "Assets/DB/Scripts/GamePlay/Quest/Base/PlayerQuestManager.cs (46,5)", questList [i]);
Quests.Add (obj.GetComponent<QuestBase>());
}
}
for (int i=0; i<Quests.Count; i++) {
if (Quests [i] != null) {
Quests [i].LoadQuest(name);
Quests [i].Info();
Quests [i].Checking();
}
}
}
( i am using this code. please help to solve this problem. )
Comment