Skip to content

Commit 59ea39e

Browse files
committed
Add README code to a sample scene
1 parent a49684b commit 59ea39e

File tree

7 files changed

+375
-0
lines changed

7 files changed

+375
-0
lines changed

Samples~/Readme.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "Gilzoide.SqliteNet.Samples.Readme",
3+
"rootNamespace": "Gilzoide.SqliteNet.Samples.Readme",
4+
"references": [
5+
"GUID:17f96cd3b93974f6493e51a2f25c1241"
6+
],
7+
"includePlatforms": [],
8+
"excludePlatforms": [],
9+
"allowUnsafeCode": false,
10+
"overrideReferences": false,
11+
"precompiledReferences": [],
12+
"autoReferenced": false,
13+
"defineConstraints": [],
14+
"versionDefines": [],
15+
"noEngineReferences": false
16+
}

Samples~/Readme/Gilzoide.SqliteNet.Samples.Readme.asmdef.meta

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Samples~/Readme/ReadmeScene.unity

Lines changed: 267 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,267 @@
1+
%YAML 1.1
2+
%TAG !u! tag:unity3d.com,2011:
3+
--- !u!29 &1
4+
OcclusionCullingSettings:
5+
m_ObjectHideFlags: 0
6+
serializedVersion: 2
7+
m_OcclusionBakeSettings:
8+
smallestOccluder: 5
9+
smallestHole: 0.25
10+
backfaceThreshold: 100
11+
m_SceneGUID: 00000000000000000000000000000000
12+
m_OcclusionCullingData: {fileID: 0}
13+
--- !u!104 &2
14+
RenderSettings:
15+
m_ObjectHideFlags: 0
16+
serializedVersion: 9
17+
m_Fog: 0
18+
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
19+
m_FogMode: 3
20+
m_FogDensity: 0.01
21+
m_LinearFogStart: 0
22+
m_LinearFogEnd: 300
23+
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
24+
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
25+
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
26+
m_AmbientIntensity: 1
27+
m_AmbientMode: 3
28+
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
29+
m_SkyboxMaterial: {fileID: 0}
30+
m_HaloStrength: 0.5
31+
m_FlareStrength: 1
32+
m_FlareFadeSpeed: 3
33+
m_HaloTexture: {fileID: 0}
34+
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
35+
m_DefaultReflectionMode: 0
36+
m_DefaultReflectionResolution: 128
37+
m_ReflectionBounces: 1
38+
m_ReflectionIntensity: 1
39+
m_CustomReflection: {fileID: 0}
40+
m_Sun: {fileID: 0}
41+
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
42+
m_UseRadianceAmbientProbe: 0
43+
--- !u!157 &3
44+
LightmapSettings:
45+
m_ObjectHideFlags: 0
46+
serializedVersion: 12
47+
m_GIWorkflowMode: 1
48+
m_GISettings:
49+
serializedVersion: 2
50+
m_BounceScale: 1
51+
m_IndirectOutputScale: 1
52+
m_AlbedoBoost: 1
53+
m_EnvironmentLightingMode: 0
54+
m_EnableBakedLightmaps: 0
55+
m_EnableRealtimeLightmaps: 0
56+
m_LightmapEditorSettings:
57+
serializedVersion: 12
58+
m_Resolution: 2
59+
m_BakeResolution: 40
60+
m_AtlasSize: 1024
61+
m_AO: 0
62+
m_AOMaxDistance: 1
63+
m_CompAOExponent: 1
64+
m_CompAOExponentDirect: 0
65+
m_ExtractAmbientOcclusion: 0
66+
m_Padding: 2
67+
m_LightmapParameters: {fileID: 0}
68+
m_LightmapsBakeMode: 1
69+
m_TextureCompression: 1
70+
m_FinalGather: 0
71+
m_FinalGatherFiltering: 1
72+
m_FinalGatherRayCount: 256
73+
m_ReflectionCompression: 2
74+
m_MixedBakeMode: 2
75+
m_BakeBackend: 1
76+
m_PVRSampling: 1
77+
m_PVRDirectSampleCount: 32
78+
m_PVRSampleCount: 512
79+
m_PVRBounces: 2
80+
m_PVREnvironmentSampleCount: 256
81+
m_PVREnvironmentReferencePointCount: 2048
82+
m_PVRFilteringMode: 1
83+
m_PVRDenoiserTypeDirect: 1
84+
m_PVRDenoiserTypeIndirect: 1
85+
m_PVRDenoiserTypeAO: 1
86+
m_PVRFilterTypeDirect: 0
87+
m_PVRFilterTypeIndirect: 0
88+
m_PVRFilterTypeAO: 0
89+
m_PVREnvironmentMIS: 1
90+
m_PVRCulling: 1
91+
m_PVRFilteringGaussRadiusDirect: 1
92+
m_PVRFilteringGaussRadiusIndirect: 5
93+
m_PVRFilteringGaussRadiusAO: 2
94+
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
95+
m_PVRFilteringAtrousPositionSigmaIndirect: 2
96+
m_PVRFilteringAtrousPositionSigmaAO: 1
97+
m_ExportTrainingData: 0
98+
m_TrainingDataDestination: TrainingData
99+
m_LightProbeSampleCountMultiplier: 4
100+
m_LightingDataAsset: {fileID: 0}
101+
m_LightingSettings: {fileID: 0}
102+
--- !u!196 &4
103+
NavMeshSettings:
104+
serializedVersion: 2
105+
m_ObjectHideFlags: 0
106+
m_BuildSettings:
107+
serializedVersion: 3
108+
agentTypeID: 0
109+
agentRadius: 0.5
110+
agentHeight: 2
111+
agentSlope: 45
112+
agentClimb: 0.4
113+
ledgeDropHeight: 0
114+
maxJumpAcrossDistance: 0
115+
minRegionArea: 2
116+
manualCellSize: 0
117+
cellSize: 0.16666667
118+
manualTileSize: 0
119+
tileSize: 256
120+
buildHeightMesh: 0
121+
maxJobWorkers: 0
122+
preserveTilesOutsideBounds: 0
123+
debug:
124+
m_Flags: 0
125+
m_NavMeshData: {fileID: 0}
126+
--- !u!1 &1915051410
127+
GameObject:
128+
m_ObjectHideFlags: 0
129+
m_CorrespondingSourceObject: {fileID: 0}
130+
m_PrefabInstance: {fileID: 0}
131+
m_PrefabAsset: {fileID: 0}
132+
serializedVersion: 6
133+
m_Component:
134+
- component: {fileID: 1915051411}
135+
- component: {fileID: 1915051412}
136+
m_Layer: 0
137+
m_Name: TestSqlite
138+
m_TagString: Untagged
139+
m_Icon: {fileID: 0}
140+
m_NavMeshLayer: 0
141+
m_StaticEditorFlags: 0
142+
m_IsActive: 1
143+
--- !u!4 &1915051411
144+
Transform:
145+
m_ObjectHideFlags: 0
146+
m_CorrespondingSourceObject: {fileID: 0}
147+
m_PrefabInstance: {fileID: 0}
148+
m_PrefabAsset: {fileID: 0}
149+
m_GameObject: {fileID: 1915051410}
150+
serializedVersion: 2
151+
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
152+
m_LocalPosition: {x: 0, y: 0, z: 0}
153+
m_LocalScale: {x: 1, y: 1, z: 1}
154+
m_ConstrainProportionsScale: 0
155+
m_Children: []
156+
m_Father: {fileID: 0}
157+
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
158+
--- !u!114 &1915051412
159+
MonoBehaviour:
160+
m_ObjectHideFlags: 0
161+
m_CorrespondingSourceObject: {fileID: 0}
162+
m_PrefabInstance: {fileID: 0}
163+
m_PrefabAsset: {fileID: 0}
164+
m_GameObject: {fileID: 1915051410}
165+
m_Enabled: 1
166+
m_EditorHideFlags: 0
167+
m_Script: {fileID: 11500000, guid: 6adceb403221c46bfa7c0060aaff46f1, type: 3}
168+
m_Name:
169+
m_EditorClassIdentifier:
170+
--- !u!1 &2060423183
171+
GameObject:
172+
m_ObjectHideFlags: 0
173+
m_CorrespondingSourceObject: {fileID: 0}
174+
m_PrefabInstance: {fileID: 0}
175+
m_PrefabAsset: {fileID: 0}
176+
serializedVersion: 6
177+
m_Component:
178+
- component: {fileID: 2060423186}
179+
- component: {fileID: 2060423185}
180+
- component: {fileID: 2060423184}
181+
m_Layer: 0
182+
m_Name: Main Camera
183+
m_TagString: MainCamera
184+
m_Icon: {fileID: 0}
185+
m_NavMeshLayer: 0
186+
m_StaticEditorFlags: 0
187+
m_IsActive: 1
188+
--- !u!81 &2060423184
189+
AudioListener:
190+
m_ObjectHideFlags: 0
191+
m_CorrespondingSourceObject: {fileID: 0}
192+
m_PrefabInstance: {fileID: 0}
193+
m_PrefabAsset: {fileID: 0}
194+
m_GameObject: {fileID: 2060423183}
195+
m_Enabled: 1
196+
--- !u!20 &2060423185
197+
Camera:
198+
m_ObjectHideFlags: 0
199+
m_CorrespondingSourceObject: {fileID: 0}
200+
m_PrefabInstance: {fileID: 0}
201+
m_PrefabAsset: {fileID: 0}
202+
m_GameObject: {fileID: 2060423183}
203+
m_Enabled: 1
204+
serializedVersion: 2
205+
m_ClearFlags: 1
206+
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
207+
m_projectionMatrixMode: 1
208+
m_GateFitMode: 2
209+
m_FOVAxisMode: 0
210+
m_Iso: 200
211+
m_ShutterSpeed: 0.005
212+
m_Aperture: 16
213+
m_FocusDistance: 10
214+
m_FocalLength: 50
215+
m_BladeCount: 5
216+
m_Curvature: {x: 2, y: 11}
217+
m_BarrelClipping: 0.25
218+
m_Anamorphism: 0
219+
m_SensorSize: {x: 36, y: 24}
220+
m_LensShift: {x: 0, y: 0}
221+
m_NormalizedViewPortRect:
222+
serializedVersion: 2
223+
x: 0
224+
y: 0
225+
width: 1
226+
height: 1
227+
near clip plane: 0.3
228+
far clip plane: 1000
229+
field of view: 60
230+
orthographic: 1
231+
orthographic size: 5
232+
m_Depth: -1
233+
m_CullingMask:
234+
serializedVersion: 2
235+
m_Bits: 4294967295
236+
m_RenderingPath: -1
237+
m_TargetTexture: {fileID: 0}
238+
m_TargetDisplay: 0
239+
m_TargetEye: 3
240+
m_HDR: 1
241+
m_AllowMSAA: 1
242+
m_AllowDynamicResolution: 0
243+
m_ForceIntoRT: 0
244+
m_OcclusionCulling: 1
245+
m_StereoConvergence: 10
246+
m_StereoSeparation: 0.022
247+
--- !u!4 &2060423186
248+
Transform:
249+
m_ObjectHideFlags: 0
250+
m_CorrespondingSourceObject: {fileID: 0}
251+
m_PrefabInstance: {fileID: 0}
252+
m_PrefabAsset: {fileID: 0}
253+
m_GameObject: {fileID: 2060423183}
254+
serializedVersion: 2
255+
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
256+
m_LocalPosition: {x: 0, y: 0, z: -10}
257+
m_LocalScale: {x: 1, y: 1, z: 1}
258+
m_ConstrainProportionsScale: 0
259+
m_Children: []
260+
m_Father: {fileID: 0}
261+
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
262+
--- !u!1660057539 &9223372036854775807
263+
SceneRoots:
264+
m_ObjectHideFlags: 0
265+
m_Roots:
266+
- {fileID: 2060423186}
267+
- {fileID: 1915051411}

Samples~/Readme/ReadmeScene.unity.meta

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Samples~/Readme/TestSqlite.cs

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
using SQLite;
2+
using UnityEngine;
3+
4+
namespace Gilzoide.SqliteNet.Samples.Readme
5+
{
6+
// The library contains simple attributes that you can use
7+
// to control the construction of tables, ORM style
8+
public class Player
9+
{
10+
[PrimaryKey, AutoIncrement]
11+
public int Id { get; set; }
12+
public string Name { get; set; }
13+
}
14+
15+
public class TestSqlite : MonoBehaviour
16+
{
17+
void Start()
18+
{
19+
// 1. Create a connection to the database.
20+
// The special ":memory:" in-memory database and
21+
// URIs like "file:///somefile" are also supported
22+
var db = new SQLiteConnection($"{Application.persistentDataPath}/MyDb.db");
23+
24+
// 2. Once you have defined your entity, you can automatically
25+
// generate tables in your database by calling CreateTable
26+
db.CreateTable<Player>();
27+
28+
// 3. You can insert rows in the database using Insert
29+
// The Insert call fills Id, which is marked with [AutoIncremented]
30+
var newPlayer = new Player
31+
{
32+
Name = "gilzoide",
33+
};
34+
db.Insert(newPlayer);
35+
Debug.Log($"Player new ID: {newPlayer.Id}");
36+
// Similar methods exist for Update and Delete.
37+
38+
// 4.a The most straightforward way to query for data
39+
// is using the Table method. This can take predicates
40+
// for constraining via WHERE clauses and/or adding ORDER BY clauses
41+
var query = db.Table<Player>().Where(p => p.Name.StartsWith("g"));
42+
foreach (Player player in query)
43+
{
44+
Debug.Log($"Found player named {player.Name} with ID {player.Id}");
45+
}
46+
47+
// 4.b You can also make queries at a low-level using the Query method
48+
var players = db.Query<Player>("SELECT * FROM Player WHERE Id = ?", 1);
49+
foreach (Player player in players)
50+
{
51+
Debug.Log($"Player with ID 1 is called {player.Name}");
52+
}
53+
54+
// 5. You can perform low-level updates to the database using the Execute
55+
// method, for example for running PRAGMAs or VACUUM
56+
db.Execute("VACUUM");
57+
}
58+
}
59+
}

Samples~/Readme/TestSqlite.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)