playMaker

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

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3205
  • Official Playmaker Support
    • View Profile
    • LinkedIn
Call Static Method (BETA)
« on: May 17, 2014, 11:28:15 AM »
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, 11:32:34 AM by Alex Chouls »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12344
  • Official Playmaker Support
    • View Profile
Re: Call Static Method (BETA)
« Reply #1 on: May 19, 2014, 06: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

  • Full Member
  • ***
  • Posts: 145
    • View Profile
Re: Call Static Method (BETA)
« Reply #2 on: May 20, 2014, 09:17:12 PM »
Hi,

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

Dev

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3205
  • Official Playmaker Support
    • View Profile
    • LinkedIn
Re: Call Static Method (BETA)
« Reply #3 on: May 20, 2014, 10:08:06 PM »
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

  • Full Member
  • ***
  • Posts: 145
    • View Profile
Re: Call Static Method (BETA)
« Reply #4 on: May 20, 2014, 10:58:34 PM »
hi,

Thanks for give so many useful information.

Dev