I am trying to write some code, and I am trying to break it up in to different classes because of the way the code will eventually need to work, and I am also working with retrieving data from the internet, so I was trying to do two new things for myself and I can’t figure out why this won’t work, here is my code:
using System.Collections;
public class SomeClass {
SomeProjectClass_www Test = new SomeProjectClass_www();
Test.GetData();
}
public class SomeProjectClass_www : IEnumerator {
public IEnumerator GetData()
{
WWW www = new WWW("file://C:\\Users\\generic_user\Documents\\test.txt");
yield return url;
Debug.Log(www.text);
}
}
The code generates a CS1519 error, in Unity3d which is what I am using. That is where the Debug.Log comes from. Sorry, I didn’t provide much useful information, I really don’t know much of whats going on.
The problem is your
SomeClasshas logic defined in the class, not in a method: