ProtoFlux:Method Proxy: Difference between revisions

From Resonite Wiki
Make the info better
Updated the method proxy page a tiny bit. (+ added note)
Line 21: Line 21:
|}}
|}}
==== What are Method Proxies ====
==== What are Method Proxies ====
Method Proxy is a node used to call a method from a component. Some components expose these methods by default such as [[Component:StaticTexture2D|StaticTexture2D]]. More hidden methods can be exposed when using the mod "ShowDelegates" from art0007i [https://github.com/art0007i/ShowDelegates], to do so, go into the inspector of any slot and you should see "---- SYNC METHODS HERE ----", clicking on that should reveal the extra methods. Using your flux tool, grab the method you want, then open your context menu and select the option "Proxy". This will spawn out a node with any number of arguments depending on the method call you choose.
The <code>Method Proxy</code> node is used to call a method from a component. Some components expose these methods by default such as [[Component:StaticTexture2D|StaticTexture2D]]. More hidden methods can be exposed when using the mod "ShowDelegates" from art0007i [https://github.com/art0007i/ShowDelegates], to do so, go into the inspector of any slot and you should see "---- SYNC METHODS HERE ----", clicking on that should reveal the extra methods. Using your flux tool, grab the method you want, then open your context menu and select the option "Proxy". This will spawn out a node with any number of arguments depending on the method call you choose.


The arguments on the Method Proxy node will be depending on the type it wants and also can depend on how many inputs it wants. This makes it very difficult to document the thousands of variants of this node (and is unwise to list them here unless there is a good explanation for the individual listing).
The arguments on the Method Proxy node will be depending on the type it wants and also can depend on how many inputs it wants. This makes it very difficult to document the thousands of variants of this node (and is unwise to list them here unless there is a good explanation for the individual listing).
Line 31: Line 31:


One common use for this node is to help with [[Cloud Spawning]], utilizing the method "OnImportFile" within the component "FileMetadata".
One common use for this node is to help with [[Cloud Spawning]], utilizing the method "OnImportFile" within the component "FileMetadata".
{{Note|There is another node similar to this but returns data as well, that node is called a [[ProtoFlux:Function Proxy|Function Proxy]].|information}}
[[Category:ProtoFlux]]
[[Category:ProtoFlux]]

Revision as of 16:44, 20 April 2024

Method Proxy
*
Next
This could be anything
This could be anything
This could be anything
This could be anything
This could be anything
Method
null
CoreNodes

What are Method Proxies

The Method Proxy node is used to call a method from a component. Some components expose these methods by default such as StaticTexture2D. More hidden methods can be exposed when using the mod "ShowDelegates" from art0007i [1], to do so, go into the inspector of any slot and you should see "---- SYNC METHODS HERE ----", clicking on that should reveal the extra methods. Using your flux tool, grab the method you want, then open your context menu and select the option "Proxy". This will spawn out a node with any number of arguments depending on the method call you choose.

The arguments on the Method Proxy node will be depending on the type it wants and also can depend on how many inputs it wants. This makes it very difficult to document the thousands of variants of this node (and is unwise to list them here unless there is a good explanation for the individual listing).

Some common methods known to use Method Proxies are System.Action methods (actions that the engine will enact upon when called). Common inputs from Method Proxies are IButton, and ButtonEventData, both are not needed to still work.

What you can do with Method Proxies

You can use Method Proxies when you want to call an internal function from the engine that is exposed and usable (presumed to be public functions and not private functions in the code [TODO: double check this]) from a defined input from a user (i.e. a button press). This is also an alternative way to do the same call compared to using the node version of it (i.e. Using the Play function instead of the Play Flux node). However there is not really an advantage to doing it this way unless you have a good reason for it.

One common use for this node is to help with Cloud Spawning, utilizing the method "OnImportFile" within the component "FileMetadata".

There is another node similar to this but returns data as well, that node is called a Function Proxy.