I am currently working on a business card project, where the user can upload these images to change the front and back of the card.
For this I downloaded the build of a blank map that I created on PlayCanvas like this:
And then I created in the index.html buttons to upload these images. These buttons call an ajax request that takes the downloaded images and puts them in the folders defined by PlayCanvas for the assets.
Now I am creating a login and registration page so each user can save these business cards, or create new ones, so the base template will still be used but the assets will be different.
And that’s where I’m stuck, I can’t understand how I can load assets based on a user id for example because the paths of the assets is defined in the config.json.
What I would like is for user A to see the business card with assets A and user B to see the business card with assets B,.
I saw there is a function FindByTag the load the assets by Tag, but my png don’t have tags , maybe i can add the user id as a tag , but i don’t know how to process.
In my case the user upload their assets alone and they don’t have acces to the editor , it is possible to add this tags(user_id) when they upload their assets with my buttons?
Where do the files that the user uploads go?
Is it only on the user device or are they uploaded to a server?
How are they retrieved later by the user again?
For example, if you wanted to load a texture from a url, it be:
this.app.assets.loadFromUrlAndFilename("https://someUrl.com/somefilename.png", "texture.png", "texture", function (err, asset) {
var texture = asset.resource;
// Do something with the loaded asset
});
And I suggest doing this at runtime with an in app loading screen rather than in the preload. It’s much easier to do workflow wise
I tried things but I can’t overwrite the paths in the json.config, it is possible to do that? because any function i use is not used because of the json.config i have the impression.
This paths looks static no?
Maybe I can change them to then be able to use my paths and be able to access images depending on the database?