FreakyChest
7 months agoMember
Can we use setTexture in local mode
Trying to create gun with some texture switching, needs to run in local. I have a script that has no issue switching between images when it is global script, when I switch to local script and chan...
- 7 months ago
Short answer is that since "local scripts cannot access or use texture assets", then MeshEntity.setTexture should not be used and shouldn't work locally. "If you want to set a new UI-optimized texture for an entity, you must send an event to a default script and let it trigger the API call" (getting started with local scripting).
MeshEntity.setTexture can work locally when you set options to the local player (but likely shouldn't work), but seems to have stability issues.meshEntity.setTexture(texture,{players:[this.entity.owner.get()]});I tested this with no options and empty array which both failed when ran locally (player owned).When I used the code above it works, but desktop editor has crashed more then once, takes a little bit of time (a min), volume goes out and freezes.