playMaker

Author Topic: Help with "Invoke Method"[SOLVED]  (Read 7384 times)

drswoboda

  • Playmaker Newbie
  • *
  • Posts: 24
Help with "Invoke Method"[SOLVED]
« on: April 04, 2014, 02:07:00 AM »
I'm trying to convert some scripts to Playmaker, but I'm still very green with the system.

I have the following script on on an empty gameObject called "Scripts."
Code: [Select]
using UnityEngine;

public class Generate : MonoBehaviour
{
public GameObject rocks;

// Use this for initialization
void Start()
{
InvokeRepeating("CreateObstacle", 1f, 1.5f);
}

void CreateObstacle()
{
Instantiate(rocks);
}
}

It instantiates a prefab for a side scrolling screen full of objects.

I have looked at the "Invoke Method" Action and played with some values, but I'm not getting it setup correctly.

Can someone give me a chair at the grown-ups table and point me in the right direction on how to convert this to Playmaker?

See attachment for my attempted setup, which give me this message:
Code: [Select]
Trying to Invoke method: Generate.CreateObstacle() couldn't be called.

Thanks,
-David
 
« Last Edit: April 04, 2014, 08:49:20 AM by jeanfabre »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Help with "Invoke Method"
« Reply #1 on: April 04, 2014, 07:30:52 AM »
Hi,

 you need to explicitly declare that funciton public:

Code: [Select]
public void CreateObstacle()
Then it's going to be accessible.

bye,

 Jean

drswoboda

  • Playmaker Newbie
  • *
  • Posts: 24
Re: Help with "Invoke Method"
« Reply #2 on: April 04, 2014, 08:43:02 AM »
Thanks Jean,

That did the trick, it works like a champ. I am very happy that I finally got this all working as this appears to be a fantastic product.

-David