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 change owner to player, it no longer works and throws, Exception encountered running bridge method 'SetMeshTexture': Failed to set mesh texture. Is there a way to use setTexture in local mode, or do we have to use a server script and then have local script send to server script?
Tested further: Made script that when I pick up, it set owner to player and switches through textures and when put down it switchers server to owner. Test server works, client doesn't, no matter how many times I go back and forth. setTexture requires textureAsset, so doesn't seem related to using the UI loading using ImageSource.fromTextureAsset(asset).
There is anoptions — Indicates the players to apply the texture for. Which is confusing, does that mean all instances of the mesh will look one way to some players and another way for others?
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.