Syncing Sprite Texture

Godot Version

4.2.2.stable

Question

I’m working on a emoji chat display, and I have a single Sprite3D. When a player opens the Emoji menu and hovers over a button, it should assign the emoji texture to the Sprite3D. This only seems to work locally, and I’m not sure how one would update the Sprite3D’s texture to be synced across Multiplayer clients.

There’s not much information on this, and what little I found didn’t really provide helpful results.

Here’s a video of what is currently happening:
https://i.imgur.com/A3pMoSC.mp4

edit: To clarify, the emoji textures are in the game directly and not being pulled from some external source.

I’m not saying this is the solution I want, but for now I’ve literally just created multiple sprites that have different textures on them and just toggling them on/off respectively. I wanted to avoid this approach because it just adds a bunch of extra nodes to my scene that I have to keep track of.

Still looking for a solution to the original problem though, if anyone knows or has guidance.

You did not post any code so I don’t know what you are doing but, while I’ve not tested this, something similar to this should work:

var emojis = [
	load('res://emojis/smile.png'),
	load('res://emojis/cry.png'),
	#...
]


@rpc("any_peer", "call_local")
func show_emoji(index:int) -> void:
	var emoji = emojis[index]
	$Sprite3D.texture = emoji
	$AnimationPlayer.play('show_emoji')
1 Like

This seems to work! I think I had the right idea of how to swap the textures, but I didn’t use an array. Thank you!