firebase / quickstart-unity

Firebase Quickstart Samples for Unity
https://firebase.google.com/games
Apache License 2.0
835 stars 433 forks source link

List<Dirictionary<string, string>> is getting send but firerstore sets it to null #1297

Closed Tzon22231 closed 2 years ago

Tzon22231 commented 2 years ago

Hey, i'm tryig to read a lot of data from firestore and thats why im trying to use List<Dirictionary<string, string>>. I have a custom List, but I can't get it converted. When I'm trying to send the Directionary, no error appiers, but in firestore the object is set to null. If I don't get the data already in one List, it's hard for the computer to conver. Thats why I need a sulution for this.

google-oss-bot commented 2 years ago

This issue does not seem to follow the issue template. Make sure you provide all the required information.

ehsannas commented 2 years ago

Hi @Tzon22231 , Can you please more all the necessary information for us to consider your ticket?

[REQUIRED] Please fill in the following fields:

[REQUIRED] Please describe the issue here:

(Please list the full steps to reproduce the issue. Include device logs, Unity logs, and stack traces if available.)

Steps to reproduce:

Have you been able to reproduce this issue with just the Firebase Unity quickstarts (this GitHub project)? What's the issue repro rate? (eg 100%, 1/5 etc)

What happened? How can we make the problem occur? This could be a description, log/console output, etc.

If you have a downloadable sample project that reproduces the bug you're reporting, you will likely receive a faster response on your issue.

Relevant Code:

// TODO(you): code here to reproduce the problem
Tzon22231 commented 2 years ago
Unity editor version: 2021.31f
Firebase Unity SDK version: dotnet 4
Source you installed the SDK: .unitypackage (.unitypackage or Unity Package Manager)
Problematic Firebase Component: Firestore(Auth, Database, etc.)
Platform you are using the Unity editor on: Windows(Mac, Windows, or Linux)
Platform you are targeting: desktop and Android(iOS, Android, and/or desktop)
Scripting Runtime: Mono(Mono, and/or IL2CPP)

I only want to know if there is an way to safe a custom List

DatabaseScript: using System.Collections; using System.Collections.Generic; using UnityEngine; using Firebase.Firestore; using Firebase; using Firebase.Extensions; using UnityEngine.UI; using UnityEngine.IO; using System; using TMPro;

public class Database : MonoBehaviour { public List Save = new List();

private void SaveData() { this.Save = GameObject.Find("Manager").GetComponent().Save; this.Found = GameObject.Find("Manager").GetComponent().found;

    List<string> End = new List<string>() { "Auto" };
    Work = true;
    StartCoroutine(ReworkLists(false));
    while (Work == true) { yield return new WaitForSeconds(0.5f); }
    User us = new User
    {
        found = this.Found,
        Save = this.Save
    };
    DocumentReference countRef =      db.Collection("Database").Document(MainDatabase).Collection(MainPassword).Document("usage");
    countRef.SetAsync(us).ContinueWithOnMainThread(task =>
    {
    });
}

}

ToSafeList:

public float Betrag;

public string Kategorie;
public string Bezeichung;
public string Art;
public string Verkaufer;
public string RedoMode;
public string Datum;
public string RedoDate;

public ToSafeList(float Betrag, string Kategorie, string Bezeichnung, string Datum, string Art, string Verkaufer, string RedoMode, string RedoDate) 
{ 
    this.Betrag = Betrag;
    this.Kategorie = Kategorie;
    this.Bezeichung = Bezeichnung;
    this.Datum = Datum;
    this.Art = Art;
    this.Verkaufer = Verkaufer;
    this.RedoMode = RedoMode;
    this.RedoDate = RedoDate;
}

User:

using System.Collections; using System.Collections.Generic; using UnityEngine; using Firebase.Firestore;

[FirestoreData] public class User { [FirestoreProperty] public List Art { get; set; } [FirestoreProperty] public int found { get; set; }

}