Skip to content

[Bug] Annoying warning when converting from a DocumentSnapshot to a class. #1144

Open
@cgascons

Description

@cgascons

[REQUIRED] Please fill in the following fields:

  • Unity editor version: 2020.3.14f1 LTS
  • Firebase Unity SDK version: 8.1.0
  • Source you installed the SDK: Unity Package Manager
  • Problematic Firebase Component: Database
  • Other Firebase Components in use: Auth, Database, Functions
  • Additional SDKs you are using: None
  • Platform you are using the Unity editor on: Windows
  • Platform you are targeting: iOS, Android, and/or desktop
  • Scripting Runtime: Mono

[REQUIRED] Please describe the issue here:

We are performing a very simple query which gets from the Firestore database a document, which comes in a DocumentSnapshot format and we are trying to convert it to a ScriptableObject, everything works just right, but there's this annoying warning in the Unity console which we can't get rid of and we were wondering if there's anything we might be doing wrong.

Steps to reproduce:

Have you been able to reproduce this issue with just the Firebase Unity quickstarts (this GitHub project)? No
What's the issue repro rate? 100%

What happened?

Log trace: BidInstanceData must be instantiated using the ScriptableObject.CreateInstance method instead of new BidInstanceData.

How can we make the problem occur?
Yes, just retrieve a document from the database and try to convert it to a ScriptableObject.

Relevant Code:

    IEnumerator ManageUserCreation()
    {
        //Get the user from the DB
        Task<DocumentSnapshot> userInDB = GetUserFromDB();

        //Wait till completed
        yield return new WaitUntil(() => userInDB.IsCompleted);

        if (userInDB.Exception != null)
            yield break;

        //Does the user exist?
        bool exists = userInDB.Result.Exists;
        if(!exists)
        {
            Debug.Log("User does not exist, creating...");

            //Create the user
            CreateUser();
        }
        else
        {
            Debug.Log("User exists, information retrieved.");

            //Assign info to player
            m_Player = userInDB.Result.ConvertTo<PlayerData>(); // <<<<===== This line generates the warning.
        }
    }

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions