• RuntimesUnity
  • How can i put gun on my character and change the gun?

i want to put gun on my character and change this in ui how can i do that?

Related Discussions
...

To put a gun on your character and change it via a UI, you can use Spine's attachment and skin features. First, ensure that your character's skeleton has a slot for the gun. You can use the SetAttachment method to change the gun attachment at runtime. For example, in Unity, you can use skeleton.SetAttachment("gunSlot", "gunName") to set the gun attachment. If you have multiple guns, you can store them as different attachments or skins and switch between them using the UI. You can also use skins to manage different weapon appearances and switch them at runtime. This approach allows you to dynamically change the weapon your character holds without needing to modify the animations or the Spine project itself.

@meanwhile An alternative is using a normal separate GameObject for the gun and letting it follow your weapon bone. You can use the BoneFollowerGraphic component for Canvas-based Unity UI.