美文网首页unity插件推荐
[Unity 3d] SQLite4Unity3d(Unity

[Unity 3d] SQLite4Unity3d(Unity

作者: 雨落随风 | 来源:发表于2019-06-25 23:44 被阅读0次

一个基于 SQLite - net的为Unity 量身打造的 SQLite 工具包。

GitHub 上的工程多如繁星,有些好的仓库,但凡不经意间错过了就很难找回,故稍作采撷,希望能帮助到有心人。
本文集以一个小的功能点为单位行文,也便于拾取罢!

简介:

SQLite4Unity3d, a plugin that helps you to use SQLite in your Unity3d projects in a clear and easy way and works in iOS, Mac, Android and Windows projects.
- 一个方便清晰明了简单的 SQLite 操作工具包,支持在 iOS, Mac, Android and Windows工程中使用。
It uses the great sqlite-net library as a base so you will have Linq besides sql. For a further reference on what possibilities you have available with this library I encourage you to visit its github repository.
-该仓库基于棒棒的sqlite-net ,所以你可以使用熟悉的Linq 语法来操作 SQLite啦,更多API请访问 sqlite-net哈。
Note: SQLite4Unity3d uses only the synchronous part of sqlite-net, so all the calls to the database are synchronous.
- 使用非异步操作API。

功能:

  • 新建/删除 db.
  • SQLite 增删改查。
  • SQLite - net 非异步API 特性支持。
  • 拷贝一丢丢代码出来晒晒太阳。
        var ds = new DataService ("existing.db"); // 打开存在的数据库
        //ds.CreateDB (); //创建数据库
        var people = ds.GetPersons ();
public IEnumerable<Person> GetPersons(){
        return _connection.Table<Person>();
    }

    public IEnumerable<Person> GetPersonsNamedRoberto(){
        return _connection.Table<Person>().Where(x => x.Name == "Roberto");
    }

    public Person GetJohnny(){
        return _connection.Table<Person>().Where(x => x.Name == "Johnny").FirstOrDefault();
    }

使用:

下载工程,打开demo即可测试

演示:

Gif录不出个啥,so 动画演示省了。
由于各个平台的特殊性,仓库作者贴心的为大家准备了视频,这倒是可以看看:

链接:

robertohuertasm/SQLite4Unity3d: SQLite made easy for Unity3d

结语:

  • 常规的 Windows Standalone App 直接就能跑的飞起哈,上面只是针对不同平台特殊性做的小贴士哈。
  • 你发现上面的演示视频均放在油管,如果打不开,别慌,请使用 油管视频下载网站 协助你的学习哈,不懂怎么用的留言私我!

本文集持续更新ing,喜欢记得点赞关注哦!

相关文章

网友评论

    本文标题:[Unity 3d] SQLite4Unity3d(Unity

    本文链接:https://www.haomeiwen.com/subject/voufcctx.html