• Runtimes
  • Is it possible to control some slots/attachments visible/invisible

when i tried my job back then i have to set animation of all number of cases
but that's complicate and lot to do
i just want to toggle each one just for make it easy

and i usually use unity but tell me it is possible in unreal also

Related Discussions
...

Yes, it is possible to control the visibility of slots and attachments programmatically in both Unity and Unreal Engine. Here are the steps and considerations for each:

Unity

  1. Setting Attachments to Null: You can set an attachment to null to hide it. This can be done every frame after the animation has been applied to ensure that the animation does not override your changes.

       slot.Attachment = null;
  2. Using SkeletonAnimation.UpdateComplete: You can use the SkeletonAnimation.UpdateComplete callback to set attachments after the animation has been applied.

       skeletonAnimation.UpdateComplete += delegate {
           slot.Attachment = null; // or set to a specific attachment
       };
  3. Avoid Keying Attachments in Animations: Ensure that your animations do not key the attachments you want to control via code. This prevents the animation from overriding your code changes.

Unreal Engine

  1. Setting Attachments to Null: Similar to Unity, you can set an attachment to null to hide it.

       slot->SetAttachment(nullptr);
  2. Using Update Callbacks: You can use update callbacks to set attachments after the animation has been applied.

       skeletonAnimation->OnUpdateComplete.AddDynamic(this, &YourClass::OnUpdateComplete);
  3. Avoid Keying Attachments in Animations: Ensure that your animations do not key the attachments you want to control via code.

General Considerations

  • Skins: Use skins to manage different sets of attachments. This can simplify the process of showing/hiding attachments.
  • Setup Mode: Use the setup mode to define the default state of your slots and attachments, and reset to this state when needed.
  • Performance: Ensure that your code changes are efficient and do not introduce performance issues by making unnecessary changes every frame.

By following these steps, you can programmatically control the visibility of slots and attachments, making your workflow simpler and more efficient.