Adding objects dynamically
It is time to get into programming. In this section, we will create C# scripts that will allow us to connect to the database and create or update records. The intention of these scripts is to make our scene dynamic. How can it benefit us to have a scene with dynamic access to a database?
Consider that, in the future, when your Metaverse is in production, with hundreds of users, you may want to implement a system that allows your users to improve their houses. To achieve this, the scripts we are going to create in the next pages will follow this flow:
- They will connect to the database and query the building we want instances of in the scene.
- If our user improves their building, we will update the property where the Prefab is stored, for the new building type.
- In this way, we can dynamically load one Prefab or another in the scene depending on the modifiable value that is outside the project in Firebase.
Impressive, isn’t it...