playMaker

Author Topic: Call Static Method (BETA)  (Read 8216 times)

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Call Static Method (BETA)
« on: May 17, 2014, 02:28:15 PM »
This action lets you call static methods in classes. It is a more advanced action that requires you to know the full class name, method name, parameters and return type. You can generally find this info in the Unity scripting reference or the API reference for the class. A future iteration on this action will add dropdown menus and shortcuts to help you fill out this info.

The attached image shows an example, calling UnityEngine.Microphone.Start to record an AudioClip.

EDIT: Just noticed that Jean made custom microphone actions a while back :P But the idea is the same, you can now call static methods without having to make custom actions...
« Last Edit: May 17, 2014, 02:32:34 PM by Alex Chouls »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Call Static Method (BETA)
« Reply #1 on: May 19, 2014, 09:36:18 AM »
Excellent!!

Yeah, these actions where only there because of this missing action you created, so very good!

Shall I test on mobile? if it uses reflections we may have some suprises here and there?

Bye,

 Jean

3d_Artist1987

  • Beta Group
  • Full Member
  • *
  • Posts: 157
Re: Call Static Method (BETA)
« Reply #2 on: May 21, 2014, 12:17:12 AM »
Hi,

Can you give more example or tut how to use this action?

Dev

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: Call Static Method (BETA)
« Reply #3 on: May 21, 2014, 01:08:06 AM »
I can give you a quick overview while we work on more documentation.

Typically you would search the Unity Script Reference for a class that sounds useful. E.g., "Microphone":
https://docs.unity3d.com/Documentation/ScriptReference/Microphone.html

Then you'd look for useful methods. E.g., "Start":
https://docs.unity3d.com/Documentation/ScriptReference/Microphone.Start.html

If in the docs you see that the method is static then you need the Call Static Method action. If it's not static you can use the Call Method action.

Next you should note the Parameters needed and the Return type. If you look at the the docs for Microphone.Start and the screenshot above, side by side, you should see how the action setup mirrors the docs. Try to setup your own Microphone.Start call to see how it works...

That's the quick overview. Note, it's an advanced action since you're interfacing directly with the Unity API. Future iterations will refine the UI so it helps you out a little more (e.g., discovering the Parameters and Return type), but for now you need to poke around the Unity docs to use this action.

Does that help?

3d_Artist1987

  • Beta Group
  • Full Member
  • *
  • Posts: 157
Re: Call Static Method (BETA)
« Reply #4 on: May 21, 2014, 01:58:34 AM »
hi,

Thanks for give so many useful information.

Dev