Unity3d ArgumentNullException:参数不能为null。
我有一个场景要注册,然后是另一个场景要播放,最后一个是排名场景。但当我试图从注册场景跳到排名场景时,看到的是没有注册的分数。Unity3d ArgumentNullException:参数不能为null。,unity3d,Unity3d,我有一个场景要注册,然后是另一个场景要播放,最后一个是排名场景。但当我试图从注册场景跳到排名场景时,看到的是没有注册的分数。 它表示(ArgumentNullException:参数不能为null。参数名称:s 我怎么能福克斯这个错误,让我看到排名第一的场景前发挥 using UnityEngine; using System.Collections; using System.Collections.Generic; public class AddScore : MonoBehaviour
它表示(ArgumentNullException:参数不能为null。参数名称:s 我怎么能福克斯这个错误,让我看到排名第一的场景前发挥
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class AddScore : MonoBehaviour {
void Start(){
AddPScore (0);
}
void AddPScore(int storeResult){
WWWForm form = new WWWForm ();
form.AddField ("user", LoginSystem.userName);
form.AddField ("score", storeResult);
WWW w = new WWW ("https://nfx.000webhostapp.com/AddScore.php",form);
StartCoroutine (receive (w));
Debug.Log("funcionou");
}
IEnumerator receive(WWW w){
yield return w;
if (w.error == null) {
}
}
}
它是否告诉您错误在哪一行?在Unity的早期版本中,我在将WWW对象作为参数传递时遇到问题。如果对象在调用中有效,则在方法中它们通常以null结尾。这可能与WWW类的内部实现有关。总之,您可能希望将WWW请求移动到receive方法中,然后删除parameterArgumentNullException:参数不能为null。参数名称:s System.Text.Encoding.GetBytes(System.String s)(在/Users/builduser/buildslave/mono运行时和classlibs/build/mcs/class/corlib/System.Text/Encoding.cs:268)UnityEngine.WWWForm.AddField(System.String字段名,System.String值,System.Text.Encoding e)UnityEngine.WWWForm.AddField(System.String fieldName,System.String value)AddScore.AddPScore(Int32 storeResult)(位于Assets/LoginSystem2/Scripts/AddScore.cs:15)AddScore.Start()(位于Assets/LoginSystem2/Scripts/AddScore.cs:11)