I need help with a code (Error code/message)

Hello i need your help.
Do you know how can i fix this error:

Video(please watch the video, i show the error.):

Here are the code:

UnityEngineInternal.APIUpdaterRuntimeServices.AddComponent (obj, “Assets/RoyalDio/Scripts/GamePlay/Quest/Base/PlayerQuestManager.cs (46,5)”, questList );
I hope you can help me.
Thanks in advance
Florian
And here are the full codes:
///
/// Quest manager. Add into Player Character this class Contain a Quest management function such as AddQuest , RemoveQuest , Checking or etc…
///
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class PlayerQuestManager : MonoBehaviour
{

  • public GUISkin skin;*

  • public GameObject TextFloating;*

  • public List Quests = new List ();*

  • public PlayerManager Player;*

  • void Start ()*

  • {*

  •   StyleManager StyleManage = (StyleManager)GameObject.FindObjectOfType (typeof(StyleManager));*
    
  •   if (StyleManage) {*
    
  •   	skin = StyleManage.GetSkin (0);*
    
  •   }*
    
  • }*

  • public void SaveQuests (string name)*

  • {*

  •   string quest_list = "";*
    
  •   for (int i=0; i<Quests.Count; i++) {*
    

_ if (Quests != null) {_
_ Quests .SaveQuest (name);
quest_list += Quests .GetType() + “|”;
* }
}_

Debug.Log ("Name Quests " + quest_list);
PlayerPrefs.SetString (“QUEST_” + name, quest_list);
_ }*_

* 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 != “”) {
Debug.Log ("Add quest " + questList );
GameObject obj = new GameObject(questList );
UnityEngineInternal.APIUpdaterRuntimeServices.AddComponent (obj, “Assets/RoyalDio/Scripts/GamePlay/Quest/Base/PlayerQuestManager.cs (46,5)”, questList );
Quests.Add (obj.GetComponent());
}
}
for (int i=0; i<Quests.Count; i++) {
if (Quests != null) {
Quests .LoadQuest(name);
Quests .Info();
Quests .Checking();
}
}
}*_

* public bool QuestHavedCheck (QuestBase quest)*
* {*
* bool res = false;*
* for (int i=0; i<Quests.Count; i++) {*
_ if (Quests != null) {
if (Quests .GetType() == quest.GetType()) {
* res = true;
break;
}
}
}
return res;
}
public QuestBase GetExistQuest (QuestBase refQuest)
{
for (int i=0; i<Quests.Count; i++) {
if (Quests != null) {
if (Quests .GetType() == refQuest.GetType()) {
return Quests ;
}
}
}
return refQuest;
}*_

* public void QuestPreparing (QuestBase quest)*
* {*
* quest.Info ();*
* }*

* public void AddQuest (QuestBase quest)*
* {*

* if (!QuestHavedCheck (quest) && Player) {*
* Debug.Log ("Add Quest " + quest.QuestName);*
* if(quest.Player)*
* addText (“Quest " + quest.QuestName + " Accepted”,quest.Player.transform.position);*
* quest.Initialize (Player);*
* Quests.Add (quest);*
* }*
* }*

* public void RemoveQuest (QuestBase quest)*
* {*
* if (QuestHavedCheck (quest)) {*
* Debug.Log ("Remove Quest " + quest.QuestName);*
* Quests.Remove (quest);*
* }*
* }*

* public void ReadEventMessage (string message)*
* {*
* for (int i=0; i<Quests.Count; i++) {*
_ if (Quests != null) {
Quests .ActioneMessage (message);
* }
}
}*_

* public void QuestCompleteCheck (QuestBase quest)*
* {*
* Debug.Log (“Quest Check”);*
* for (int i=0; i<Quests.Count; i++) {*
_ if (Quests != null) {
if (Quests == quest) {
if (Quests .IsSuccess) {
Quests .Rewarded ();
* if (TextFloating) {
if(Quests.Player)
addText (“Quest Complete”,Quests.Player.transform.position);
}
RemoveQuest (Quests );
}
}
}
}
}*_

* void Update ()*
* {*
* if(!Player){*
* Player = (PlayerManager)GameObject.FindObjectOfType(typeof(PlayerManager));*
* }*

* for (int i=0; i<Quests.Count; i++) {*
_ if (Quests != null) {
Quests .Player = Player;
Quests .UpdateQuest ();
* }
}
}*_

* void addText (string text,Vector3 pos)*
* {*
* if (TextFloating) {*
* GameObject floattext = (GameObject)GameObject.Instantiate (TextFloating,pos, Quaternion.identity); *
* floattext.GetComponent ().Text = text;*
* } *
* }*
* void OnGUI ()*
* {*
* if (skin)*
* GUI.skin = skin;*
* }*
* public void DrawQuestList ()*
* {*
* if (Quests.Count > 0) {*
* GUI.skin.label.fontSize = 16;*
* GUI.skin.label.normal.textColor = Color.white;*
* GUI.skin.label.alignment = TextAnchor.UpperRight;*
* GUI.Label (new Rect (Screen.width - 350, 110, 300, 30), “Quests”);*
* }*
* for (int i=0; i<Quests.Count; i++) {*
_ if (Quests != null) {
DrawQuest (Quests , new Vector2 (Screen.width - 350, 140 + (i * 30)));
* }
}
}
public void DrawQuest (QuestBase quest, Vector2 position)
{*_

* if (quest.IsSuccess) {*
* GUI.skin.label.normal.textColor = Color.green;*
* } else {*
* GUI.skin.label.normal.textColor = Color.yellow;*
* }*

* GUI.Label (new Rect (position.x, position.y, 300, 30), quest.QuestDisplay);*
* }*
}

So basically what is happening is you aren’t really understanding what the error is telling you.

This is what its saying:

  1. Don’t use UnityEngineInternal.APIUpdaterRuntimeServices.AddComponent
  2. Do Use GameObject.AddComponent<T>() OR GameObject.AddComponent(Type)

so you need to do the following:

GameObject.AddComponent<Script>();

or

GameObject.AddComponent("Script");