c# - Use non monoBehaviour class in unity -
i'm going through bug or @ least don't get.
i'm trying use sqlite database in unity project.
here error get:
the databasemanager class monobehaviour class.
here looks like:
using unityengine; using system.collections; public class databasemanager : monobehaviour { sqlitedatabase sqldb; void awake() { string dbpath = system.io.path.combine (application.persistentdatapath, "game.db"); var dbtemplatepath = system.io.path.combine(application.streamingassetspath, "default.db"); if (!system.io.file.exists(dbpath)) { // game database not exists, copy default db template if (application.platform == runtimeplatform.android) { // must use www streaming asset www reader = new www(dbtemplatepath); while ( !reader.isdone) {} system.io.file.writeallbytes(dbpath, reader.bytes); } else { system.io.file.copy(dbtemplatepath, dbpath, true); } } sqldb = new sqlitedatabase(dbpath); } }
the thing if got right, fact put scripts under assets folder should enough them work , recognize classes in other files. problem simple databasemanager class not recognize sqlitedatabase class implemented in sqlitedatabase.cs
have had issue or did miss on how reference non monobehaviour script in monobehaviour 1 ?
edit:
i used tutorial : here
thanks !
you seem having minor capitalization typo in code.
replace sqlitedatabase sqldb
sqlitedatabase sqldb
.
Comments
Post a Comment