I need help with a error: APIUpdaterRuntimeServices
Hello i need your help. Do you know how can i fix this error:
Video(please watch the video, i show the error.): https://www.youtube.com/watch?v=JY2WbA-rm78
Here are the code:
UnityEngineInternal.APIUpdaterRuntimeServices.AddComponent (obj, "Assets/RoyalDio/Scripts/GamePlay/Quest/Base/PlayerQuestManager.cs (46,5)", questList [i]);
I hope you can help. Thanks in advance Florian
And here are all codes in the file:
/// /// 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<QuestBase> Quests = new List<QuestBase> ();
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 [i] != null) {
Quests [i].SaveQuest (name);
quest_list += Quests [i].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 [i] != "") {
Debug.Log ("Add quest " + questList [i]);
GameObject obj = new GameObject(questList [i]);
UnityEngineInternal.APIUpdaterRuntimeServices.AddComponent (obj, "Assets/RoyalDio/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();
}
}
}
public bool QuestHavedCheck (QuestBase quest)
{
bool res = false;
for (int i=0; i<Quests.Count; i++) {
if (Quests [i] != null) {
if (Quests [i].GetType() == quest.GetType()) {
res = true;
break;
}
}
}
return res;
}
public QuestBase GetExistQuest (QuestBase refQuest)
{
for (int i=0; i<Quests.Count; i++) {
if (Quests [i] != null) {
if (Quests [i].GetType() == refQuest.GetType()) {
return Quests [i];
}
}
}
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 [i] != null) {
Quests [i].ActioneMessage (message);
}
}
}
public void QuestCompleteCheck (QuestBase quest)
{
Debug.Log ("Quest Check");
for (int i=0; i<Quests.Count; i++) {
if (Quests [i] != null) {
if (Quests [i] == quest) {
if (Quests [i].IsSuccess) {
Quests [i].Rewarded ();
if (TextFloating) {
if(Quests[i].Player)
addText ("Quest Complete",Quests[i].Player.transform.position);
}
RemoveQuest (Quests [i]);
}
}
}
}
}
void Update ()
{
if(!Player){
Player = (PlayerManager)GameObject.FindObjectOfType(typeof(PlayerManager));
}
for (int i=0; i<Quests.Count; i++) {
if (Quests [i] != null) {
Quests [i].Player = Player;
Quests [i].UpdateQuest ();
}
}
}
void addText (string text,Vector3 pos)
{
if (TextFloating) {
GameObject floattext = (GameObject)GameObject.Instantiate (TextFloating,pos, Quaternion.identity);
floattext.GetComponent<FloatingText> ().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 [i] != null) {
DrawQuest (Quests [i], 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);
}
}
Your answer
Follow this Question
Related Questions
"Level Manager" trying to update deprecated code 1 Answer
Getting an error: Assertion failed on expression: 'SUCCEEDED(hr)' 5 Answers
Why is my instance removed by Unity? 1 Answer
"error CS1525: Unexpected symbol `end-of-file' " I've tried everything.... 1 Answer
Unity 2017 or 5.6 Doesn't work after install. Editor is broken. 0 Answers