Answer the question
In order to leave comments, you need to log in
How to write counter (variable) data from Unity to SQLite database??
Good day! I'm making a game on Unity, the player collects items that one of the variables counts. It is necessary to record the number of items found per game in the database. Can you please tell me how to record the number of items found in the database when the game is closed?
item counting and collection code:
using System.Collections;
using UnityEngine;
public class RaycastExample : MonoBehaviour
{
public string ObjectTag;
public bool MissionObjects;
public int device;
public GUIStyle style;
void OnGUI () {
GUI.Label (new Rect (20, 50, 200, 50), "Найденно устройств: " + device);
}
private void Update()
{
if (Input.GetMouseButtonDown(0))
{
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
if (Physics.Raycast(ray, out hit))
{
if (hit.transform.CompareTag("PickUp"))
{
device++;
Destroy(hit.transform.gameObject);
}
}
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question