Skip to main content
December 27, 2023
Question

Communicating between Prototype and Figma Plugin

  • December 27, 2023
  • 18 replies
  • 956 views

I’ve created a Figma plugin to get the state of local variables then trigger external API’s based on that state change.

I’m trying to have a prototype instance of the file communicate with the Figma Plugin I created so when I click a UI element in the prototype, a variable changes which triggers an external API. Right now, there’s no way I can find to ‘listen’ for the variable state change in a prototype because it does not ‘write’ to the original variable value.

18 replies

tank666
December 27, 2023

Plugins cannot run in Presentation mode, and therefore receive changes from the prototype.

UX/UI designer. Figma expert. Creator and developer of plugins and widgets for Figma and FigJam. Check out my resources in Figma Community: figma.com/@tank
xiduzo
New Participant
September 8, 2024

is this still the current behaviour? or can the plugin API already access the prototype variable values?

Ready to bridge the gap between the real world and design tools? Checkout https://www.figma.com/community/plugin/1373258770799080545/microflow-hardware-bridge
djv
Figmate
Community Support
September 9, 2024

Hey @xiduzo, thanks for following up!

This is still the expected behavior. Plugins do not run in Presentation mode.

Amy_Pham
New Member
September 19, 2024

I’d like to request enabling plugins in prototype mode. I’ve been working on a plugin called Punchcut Audio Player that allows users to prototype audio in design mode, and we’ve received numerous requests to extend its functionality to prototype mode as well.
Prototypes are becoming more than a click-through of screens. We’re using them as story-telling tools, interactive exercises for user research, and demonstrations of multisensory/multidevice systems. With the addition of variables, prototypes could evolve even further.

Given the current limitations of prototypes, my team is looking to other tools and workarounds to keep up with our changing prototyping needs, but we do want to stay within Figma.

Over the past 2 years, it looks like others have been requesting features that would be solved by this as well:
Audio In A Prototype
Voice Prototyping On Figma
Give Us A Way To Snapshot Prototypes And Send Snapshot Links
Bringing Automated Testing To Figma Prototypes
Communicating Between Prototype And Figma Plugin
Feature Request Prototype Integration

The endless possibility and flexibility of plugins in design mode is what makes Figma stand out as a tool and we would love the same empowering capabilities in prototype mode.

Akshat_Srivastava
September 20, 2024

This would be a game changer on so many levels. 🤞🏾

Joo_Hyung_Park
New Member
September 23, 2024

I agree. I’m also making a usability test plug-in using AI… Compared to the original features of the AI model I’m based on, this Figma flog-in version remains at a very low level of simply analyzing only one page due to API limitations.

I hope that Figma can obtain information from the prototype screen as an API, and release a new API that can manipulate the screen instead.

klever - Instant Usability testing – Figma

Original AI model(Python)

xiduzo
New Participant
January 15, 2025

Hey ​@dvaliao, I think my last reply was taken away due to the migration to the new forum (love it by the way) and me not reading the huge banner on top. User never read right :p

Anyway, I was wondering if this is something which is being noticed as a actual bug?

I can see that plugins, like https://www.figma.com/community/plugin/1355055910166329140/variables-inspector, are using the https://www.figma.com/plugin-docs/api/properties/nodes-setboundvariable/ API to actually get updates from within the presentation mode.

This to me indicates that Figma has access to these variable changes from within the presentation mode, however slightly limited, and it would be wonderful for plugin developers to gain access to this as well!

I can imagine extending the current variable API with `.getPreviewVariablesAsync` similar to https://www.figma.com/plugin-docs/api/properties/figma-variables-getlocalvariablesasync/ or `.getPreviewVariableByIdAsync` like https://www.figma.com/plugin-docs/api/properties/figma-variables-getvariablebyidasync/.

Curious to hear your thoughts on this or any update regarding this issue!

Ready to bridge the gap between the real world and design tools? Checkout https://www.figma.com/community/plugin/1373258770799080545/microflow-hardware-bridge
xiduzo
New Participant
January 15, 2025

+1 on this feature.

I am developing a plugin which allows users to directly integrate their designs with hardware components. Getting “data” into Figma and setting variables is super easy thanks to the current API. Any changes in the “real” variables will reflect in the prototype/preview.

Getting “data” out however is impossible unless hacked together. Right now I am asking from the users to open a link in their prototype to my website containing both the variableID and the desired value. I am picking up this request and then send this value back to my plugin and from here on it will update the prototype/preview. This is super cumbersome and while running workshops it is super confusing to the people using the plugin.

It would be amazing if we can “just” have access to the variable values from within the preview mode, similar to the access we have of the variables in design mode, and listen to changes over here. This will also allow for more advanced prototyping and fully utulize Figma and its’ prototyping with variables without having users to leave Figma just to come back to see the update.

Any update on this would be greatly appreciated!

Ready to bridge the gap between the real world and design tools? Checkout https://www.figma.com/community/plugin/1373258770799080545/microflow-hardware-bridge
djv
Figmate
Community Support
January 15, 2025

Hi @xiduzo, thanks for replying again!

Yes - it does seem that your last reply was lost in the migration, but glad to hear you’re loving the changes. 😁


I took a look at your linked plugin, and yes - you can use a plugin in editor mode, so that your changes can/will appear in real-time to viewers of a presentation. That’s how the plugin you’ve linked is able to been seen in prototype mode. But keep in mind, there is still no way to run a plugin in presentation mode, so this is still expected behavior rather than a bug.

As shown in their YouTube demo, they run the plugin first in editor mode then switch to view the frame running the plugin in presentation mode. Again, you can’t “run” a plugin in a prototype itself, but you can always run them in a separate Figma edit window and still see it if set up to be visible within presentation mode. Hope this helps clarify! 



 

xiduzo
New Participant
January 16, 2025

Thank you for your quick answer,

I think there might be some misunderstanding of what I am asking here.

I would like to know if it is possible to gain access to the variable values from the running preview mode. And if not, is there any feature plans to allow this in the (hopefully near) future?

I understand that, as of right now, you are not able to run the plugin directly inside of the preview mode, this is not what I am asking for.

However, I can see that the preview mode does react to changes of variables from the editor mode (your local variables) and the preview mode does have some way of updating values bound to variables (like the linked plugin is doing).

It does not make sense to me that my plugin, which runs from the editor mode, can affect variables in the preview mode by editing the local variables via the API but that same plugin does not have any access to see what are the values of that running preview.

For example;

I made a simple shopping cart page with some prototyping logic that calculates the amount of items the user has added to the cart (using variables) and based on the items price (using variables) I can calculate the total shopping cart amount (again, using variables). With all of this neat prototyping I can update the UI perfectly by linking text frames to the above mentioned variables.

Now, I would also be interested, from my plugin running in editor mode, to see the current state of the variables of the preview mode, not just of the local variables I have declared (which do not update from prototyping interactions).

I hope this clarifies the issue and I am looking forward to your response!


Cheers

Ready to bridge the gap between the real world and design tools? Checkout https://www.figma.com/community/plugin/1373258770799080545/microflow-hardware-bridge