Class Instancing

Hello.
I need to get values from instance of class across the patch in different contexts (for example, in delegate)

So can I create a class initialization and then make a global instance of this class somehow?
We discuss about singleton with my friend, but it’s seems like in modern VL this concept is obsolete.

It’s now called SingleInstance. It is a region where you patch the initialization of the single instance. then you can make a process node out of it and use it everywhere where you need this single instance.

the first call to this node will initialize the instance and all other calls after that will get this instance.

2 Likes

Here is another example that is local per app (document) instead of global:
SingleInstancePerApp.vl (14.3 KB)

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.