Hello, I have a script that passes plain text to this script (code below) which sends the data to a php file which processes the plain text file and encrypts it with MD5. After encryption it is sent back to the file below, which is returned back to the original script. However, I’m getting a lot of errors. My errors are dealing with me being able to access the file from the code below. The file isn’t atttached to any object. But I can successfully utilize the main function Encrypt from the original script. The problem occurs when I get tot eh StartCoroutine, it says I can’t do the Coroutine because its non static. How do I fix this?
using UnityEngine;
using System.Collections;
using System.Security.Cryptography;
public class EncryptData : MonoBehaviour
{
public float transparent;
private string url;
public WWW w;
public WWWForm loginform = new WWWForm();
public string formText;
public string text;
// Use this for initialization
static void Start ()
{
}
// Update is called once per frame
void Update ()
{
}
public static string Encrypt (string originaltext)
{
text = originaltext;
StartCoroutine(EncryptText());
print("string is " + formText);
return(formText);
}
IEnumerator EncryptText()
{
url = "EncryptData.php?&text=" + WWW.EscapeURL (text);
w = new WWW (url);
yield return w;
if (w.error != null) {
print (w.error);
}
if (w.error == null) {
formText = w.text;
w.Dispose ();
formText.Trim();
StopAllCoroutines();
}
}
}