Hi,
I’m trying to create a mobile game using sqlite as a database. To do this, I’m using SQLite4Unity3d (github here) with an existing database. His sample project works perfectly when I try to run it and when I build it on a phone. So I adapted his project to mine by creating a Note class like his Person class but when I go back to the unit editor an error appears, like below, even though the methods using this class work.
Searching the web it looked like another class called Note was also being used, which was true (and was a monobehavior) but I removed it and the error still appears. The list of my scripts in my project with Note in their name listed here:
I guess residuals from the old class could be a problem but I don’t know how to know if there is some and so how to find and remove them.
Here is my Note.cs :
using SQLite4Unity3d;
public class Note
{
[PrimaryKey, AutoIncrement]
public int Id { get; set; }
public int IdPartition { get; set; }
public double Midi { get; set; }
public double Mesure { get; set; }
public int Ticks { get; set; }
public int Duration { get; set; }
public int Time { get; set; }
}
Here is the Person class from which I am inspired
using SQLite4Unity3d;
public class Person {
[PrimaryKey, AutoIncrement]
public int Id { get; set; }
public string Name { get; set; }
public string Surname { get; set; }
public int Age { get; set; }
public override string ToString ()
{
return string.Format ("[Person: Id={0}, Name={1}, Surname={2}, Age={3}]", Id, Name, Surname, Age);
}
}
It’s likely leftover in the “Library” folder. You can delete that folder and it’ll be regenerated although depending on the size of your project, it might take some time. Obviously you’ll need to ensure you’ve not got the project loaded at the time.
Just tried but still not the solution.
Maybe in fact there are some prefabs/scripts using the old Note.cs because they have the same name, but I don’t know if there is a way to find them easily…
I will try by changing the name
This can also happen if you add a script to a gameobject and then (for whatever reason) that script no longer inherits from MonoBehavior. Just redefine your class as
public class MYCLASS : MonoBehaviour {
Happened to me when consolidating virtual classes with children and screwing up the class definition. good luck out there devs
The cause of the problem is the presence of both system.collections and system Namespaces. Try creating the required class in other script and give a reference here.