Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: SimonRinkyDinkyCo on August 28, 2013, 10:56:08 PM

Title: How do you use the new Call Method action?[SOLVED]
Post by: SimonRinkyDinkyCo on August 28, 2013, 10:56:08 PM
Hi,

Could you please give a quick example of how to use the new Call Method action in Playmaker?

Thanks!
Title: Re: How do you use the new Call Method action?
Post by: 3d_Artist1987 on August 29, 2013, 10:16:54 AM
+1
Title: Re: How do you use the new Call Method action?
Post by: SimonRinkyDinkyCo on August 30, 2013, 05:08:15 PM
Please help and/or add it to the wiki. It is a new action and apparently powerful, but I don't know how to use it properly and there doesn't seem to be any reference material to go over to learn on my own. I should also mention that there isn't even a tooltip associated with the action...Please help me learn.
Title: Re: How do you use the new Call Method action?
Post by: Alex Chouls on August 30, 2013, 08:47:43 PM
I'm at unite and on travelling back this weekend. I'll add a better write-up next week, but here's a brief overview:

This action is designed to call methods on a script attached to a game object.
Drag the script into the Behavior parameter slot.
Then enter the name of the method to call.
The error checker will guide you through the required parameters and return type.


Title: Re: How do you use the new Call Method action?
Post by: SimonRinkyDinkyCo on August 31, 2013, 04:10:45 AM
Great, thanks Alex. I hope you enjoyed Unite! Safe travels.
Title: Re: How do you use the new Call Method action?[SOLVED]
Post by: louismg on December 07, 2013, 12:43:58 PM
I have a .cs script attached to a camera.  In that script I have this function:

Code: [Select]

using UnityEngine;
using System.Collections;



public class CurrentCar : MonoBehaviour {

blablabla

void CarPlatformChange(GameObject platform, GameObject car)
{ blabla
 

I need to invoke CarPlatformChange from an FSM using "Call Method".  No matter what I try to drag in the "Behavior" field of the action, it does not work.  I tried to drag the script itself, the camera object or the script component from the camera inspector.

The FSM has two local variables of type GameObject that point to the objects I want to pass to the script.

Help!

Louis
Title: Re: How do you use the new Call Method action?
Post by: louismg on December 07, 2013, 08:46:17 PM
Ok, I think I found a bug

I found out that I could not drag the behaviour in the "behaviour" field because the FSM in which I am trying to do that is defined via a template. If I was in a normal FSM, I could drag the behaviour without any problem.


PS: and yes, I eventually added "public" to the CarPlatformChange function, which should have been there in the first place.

note: added bug report in forum bug report topic.
Title: Re: How do you use the new Call Method action?[SOLVED]
Post by: jeanfabre on December 09, 2013, 01:45:21 PM
Hi,

 do that programmatically using "Get Component" and store it into a FsmObject, then you can use it in the Call Method.

bye,

 Jean
Title: Re: How do you use the new Call Method action?[SOLVED]
Post by: mthicke on March 04, 2014, 09:15:59 PM
I'm having trouble with this. I can't seem to attach a script - if I drag it nothing happens, and there are no scripts available if i click the dot.
Title: Re: How do you use the new Call Method action?[SOLVED]
Post by: jeanfabre on March 06, 2014, 12:10:44 AM
Hi,

 Tutorial on its way :)

 as a side note if dragging onto the action give you trouble do the following instead:

 create an object variable and define its type to be of the component you want to call one of its method, then drag onto that Fsm Object variable your component.

then in the call method use this Fsm object variable, it may be clearer like that for you.

bye,

 Jean
Title: Re: How do you use the new Call Method action?[SOLVED]
Post by: Lane on March 06, 2014, 09:09:09 AM
Gonna try to put together an example and get a tutorial online for this tomorrow to properly explain how it works, if not tomorrow then it'll be next week.
Title: Re: How do you use the new Call Method action?[SOLVED]
Post by: boblin on May 02, 2014, 03:05:48 AM
When i try to use it on another objects' scripts by
get component -> call method
Call method says "behaviour is invalid".
Probably because it is not defined at the design time . Any suggestions? What am i doing wrong?
Title: Re: How do you use the new Call Method action?[SOLVED]
Post by: grimmy on May 02, 2014, 05:52:46 AM
I have exactly the same issue today as you. :D Somebody please help us!
Title: Re: How do you use the new Call Method action?[SOLVED]
Post by: Alex Chouls on May 03, 2014, 05:55:41 AM
Can you post a screenshot showing how the actions are setup?
Title: Re: How do you use the new Call Method action?[SOLVED]
Post by: ahren on May 04, 2014, 07:08:43 AM
Seeing a similar behaviour (snicker) when I try to Call Method on a global object variable.

Runtime is no problem; but I get lost of design time errors about the invalid behaviour, most likely because DoCache is getting a null cachedBehaviour as it doesn't exist yet.

For the record my global var is a game state object which has methods and data that must be referenced by pre-fabs that are dynamically spawned in. Hence the global var route.
Title: Re: How do you use the new Call Method action?[SOLVED]
Post by: jeanfabre on May 06, 2014, 07:48:53 AM
Hi,

 it would help to get a repro scene so that I can look this up properly.

bye,

 Jean
Title: Re: How do you use the new Call Method action?
Post by: tman1978 on June 04, 2014, 12:19:44 PM
Hi,

 it would help to get a repro scene so that I can look this up properly.

bye,

 Jean

Hello,

I have created a sample scene that displays the problem. Import the attached unitypackage into an empty project that only has PlayMaker installed. Once imported, open the sample scene named "scene" then open the PlayMaker editor. You'll see the error I've included in the screenshot below.

To get around this problem I converted my function to a property and used GetProperty instead.

(http://i62.tinypic.com/2zpt5wp.png)
Title: Re: How do you use the new Call Method action?[SOLVED]
Post by: Alex Chouls on June 04, 2014, 02:07:45 PM
Thanks for the repro project - I'll take a look...
Title: Re: How do you use the new Call Method action?[SOLVED]
Post by: Alex Chouls on June 04, 2014, 07:42:11 PM
I've posted an updated Call Method action here:
http://hutonggames.com/playmakerforum/index.php?topic=7526.msg36344

Please test this if you get a chance... thanks!
Title: Re: How do you use the new Call Method action?[SOLVED]
Post by: tman1978 on June 04, 2014, 09:26:58 PM
I've posted an updated Call Method action here:
http://hutonggames.com/playmakerforum/index.php?topic=7526.msg36344

Please test this if you get a chance... thanks!

Tested in my sample project and it works. Thanks for the quick response.