playMaker

Author Topic: [SOLVED]Invoking Method or Call method?  (Read 1991 times)

Alatriste

  • Full Member
  • ***
  • Posts: 193
[SOLVED]Invoking Method or Call method?
« on: December 24, 2018, 11:37:12 AM »
Hi,

I'm not very familiar with those actions so bear with me.
I have this inventory add-on and I want to open the inventory UI panel through playmaker. I'm not sure how I can call the method to do it, because when I use the "Invoke Method"  I'm only getting the following error message:

Code: [Select]
NullReferenceException: Object reference not set to an instance of an object
MoreMountains.InventoryEngine.InventoryInputManager.OpenInventory () (at Assets/InventoryEngine/InventoryEngine/Scripts/Core/InventoryInputManager.cs:142)

Attached is the script of the object I'm referencing. I'm probably doing something wrong...



« Last Edit: January 03, 2019, 05:04:50 AM by Alatriste »

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: Invoking Method or Call method?
« Reply #1 on: December 29, 2018, 04:33:47 PM »
It's hard to debug without knowing more about the third party code.

It is successfully calling the method, but the method is looking for an MMEventManager that is null maybe...

I notice the OpenInventory method is protected so it might be more of an internal call that needs setup. I would check with the author of the library or check their API docs for the method you should call to open the inventory.

EDIT: In general you can use Invoke Method if the method has no parameters or a return value. If the method has parameters or return you should use Call Method. The action should automatically find the required parameters etc.
« Last Edit: December 29, 2018, 04:36:48 PM by Alex Chouls »

Alatriste

  • Full Member
  • ***
  • Posts: 193
Re: Invoking Method or Call method?
« Reply #2 on: December 30, 2018, 05:41:18 AM »
I'll check it out and I'll post the solution once I find it. 😊

Thanks Alex.

Alatriste

  • Full Member
  • ***
  • Posts: 193
Re: Invoking Method or Call method?
« Reply #3 on: January 03, 2019, 05:04:18 AM »
An update regarding this topic:

There was a problem with my current version of Unity (2018.19.9f2) For some reason the invoke method wasn't working. I just updated to Unity latest version (2018.3.0f2) and it works perfectly fine.

I can invoke the function and the inventory window opens.

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: [SOLVED]Invoking Method or Call method?
« Reply #4 on: January 13, 2019, 09:26:58 AM »
Thanks for the update!