[SOLVED] Material switching

What is the equivalent of this in the old scripts in new scripts?

this.entity.findByName(this.pmodel).model.model.meshInstances[0].material = app.assets.find(this.texTure,'material').resources[0];


The API calls are all the same, the major difference is how you access common objects (entity, app etc).

Just change app to this.app if you aren’t creating an app variable explicitly.

:stuck_out_tongue: indeed was more simple than i thought, i also have an error in this line

index = Math.floor(ROT.RNG.getUniform() * this.level.freeCells[lv].length);

it says ROT is not defined

Well, what’s ROT? That’s not a Playcanvas class.

Yea just guessed what it is…damn…i have spent 1 hr to search for nothing LOL Thanks @Leonidas

1 Like