Hey,
I’m currently trying to load the textures with a script, the problem is that when I use my script to load the textures, there are black borders that appear while in the editor no
I specify for my script I use the Zip version of the project
There is the model in PlayCanvas editor :
There is the model in Zip Version with my Script to load texture :
There is my script to load texture :
var LoadRecto = pc.createScript('loadRecto');
LoadRecto.attributes.add('loadingScreenEntity', {
type: 'entity'
});
// initialize code called once per entity
LoadRecto.prototype.initialize = function () {
this.app.assets.loadFromUrl(this.getFileFromUser(), "texture", function (err, asset) {
var recto = this.entity.render.meshInstances[1].material;
recto.diffuseMap = asset.resource;
recto.update();
}.bind(this));
};
// update code called every frame
LoadRecto.prototype.getFileFromUser = function (dt) {
id = 0;
const queryString = window.location.search;
console.log(queryString);
console.log('balbla');
var url_string = window.location.href
var url = new URL(url_string);
var c = url.searchParams.get("token");
var b = url.searchParams.get("startScene");
console.log(b)
console.log(c);
url = `texture/${b}-${c}-recto-texture.png`;
return url;
};
// swap method called for script hot-reloading
// inherit your script state here
// LoadRecto.prototype.swap = function(old) { };
// to learn more about script anatomy, please read:
// http://developer.playcanvas.com/en/user-manual/scripting/
Maybe my script is bad ? i don’t know
Thanks