- Home /
Ambiguous reference error with JS
When I write this into my script, I get the ambiguous reference error. WHY????
function send(data, username) {
var form = new WWWForm();
form.AddField("action", "send");
form.AddField("score", data);
form.AddField("username", username);
var url = "http://buiud.com/ucannon/postScore.php";
var w = WWW(url, form);
yield w;
}
send(999, "phpservisi");
1st error is regarding line; form.AddField("action", "send");
Assets/ObjectivesManager.js(15,18): BCE0004: Ambiguous reference 'AddField': UnityEngine.WWWForm.AddField(String, int), UnityEngine.WWWForm.AddField(String, String).
2nd is for the line right after the first one
Assets/ObjectivesManager.js(16,22): BCE0004: Ambiguous reference 'AddField': UnityEngine.WWWForm.AddField(String, int), UnityEngine.WWWForm.AddField(String, String).
What's the full text of the error message? Whatever is going wrong, I'm not able to reproduce it with the information given.
Answer by robertbu · Jun 05, 2014 at 06:57 AM
When you declared the function, you did not give a type to 'data'. I'm not sure what 'data' represents here, but you need to change the function declaration to:
functions send(data : string, username : string) {
or...
function send(data : int, username : string) {
Your answer
