playMaker

Author Topic: How to check whether Playmaker exists in a project [SOLVED]  (Read 3116 times)

AlexKertis

  • Playmaker Newbie
  • *
  • Posts: 1
How to check whether Playmaker exists in a project [SOLVED]
« on: December 28, 2015, 07:39:58 AM »
Hello!

Short question:

Is there "#define PLAYMAKER" or something similar in playmaker's scripts, so compiler could understand if Playmaker is included in the project?


Long question:

I'm working on an asset for Unity asset store and want to implement its interaction with some other popular assets starting with Playmaker (being one of the most popular). I dont want to ship my asset as different script packs for different combinations of addons (eg. one script version for interaction with Playmaker, one version for some other addon, one version which have the ability to interact with both, etc.). So I need a method to check whether Playmaker (or possibly other addon, but here I ask about Playmaker only) exists in a project.

C# preprocessor directives can do the work and I'm curios if any Playmaker-related keywords already defined in Playmaker scripts (or should I define them in my scripts which is less convenient for end users). The interaction I'm talking about is simply "send event as string to a specified Playmaker FSM", so I can just paste all Playmaker related stuff within #if ... #endif block.

Or maybe there are any other methods of solving this?

EDIT: Looks like the scope of #define directive in C# is just one file, so its not possible to use it as descibed above. So the question remains: are there any other methods to know if Playamker exists in a project?
« Last Edit: April 08, 2016, 11:29:52 AM by Alex Chouls »

MOST2K2

  • Playmaker Newbie
  • *
  • Posts: 18
    • Publisher Profile Unity Assetstore
Re: How to check whether Playmaker exists in a project
« Reply #1 on: February 08, 2016, 06:50:04 AM »
Did you find a solution for this? I have the same problem.
ZigZag Endless Runner Game Template http://u3d.as/nDw
Swipe Controller for Android/iOS http://u3d.as/bXu
Ball Memory Train your Brain Complete Project http://u3d.as/jUz
LED Blinker Notifications for Android goo.gl/o5pBB3

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4002
  • Official Playmaker Support
    • LinkedIn
Re: How to check whether Playmaker exists in a project
« Reply #2 on: February 08, 2016, 12:57:36 PM »
You could use the GUID for the PlayMaker.dll to see if the file exists:

Code: [Select]
var path = AssetDatabase.GUIDToAssetPath("e743331561ef77147ae48cda9bcb8209");
Check path to see if it's empty...

EDIT: You could use this to set the scripting defines for the project:
http://docs.unity3d.com/ScriptReference/PlayerSettings.SetScriptingDefineSymbolsForGroup.html

We plan to add this to Playmaker soon, so it will ship with some defines...

« Last Edit: February 08, 2016, 02:36:11 PM by Alex Chouls »

MOST2K2

  • Playmaker Newbie
  • *
  • Posts: 18
    • Publisher Profile Unity Assetstore
Re: How to check whether Playmaker exists in a project
« Reply #3 on: February 14, 2016, 04:34:53 AM »
ok thanks!
ZigZag Endless Runner Game Template http://u3d.as/nDw
Swipe Controller for Android/iOS http://u3d.as/bXu
Ball Memory Train your Brain Complete Project http://u3d.as/jUz
LED Blinker Notifications for Android goo.gl/o5pBB3

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4002
  • Official Playmaker Support
    • LinkedIn
Re: How to check whether Playmaker exists in a project
« Reply #4 on: February 14, 2016, 10:59:47 AM »
The latest version in the store should now automatically add playmaker defines to the project.

MOST2K2

  • Playmaker Newbie
  • *
  • Posts: 18
    • Publisher Profile Unity Assetstore
Re: How to check whether Playmaker exists in a project
« Reply #5 on: April 08, 2016, 07:23:25 AM »
ok thanks!
ZigZag Endless Runner Game Template http://u3d.as/nDw
Swipe Controller for Android/iOS http://u3d.as/bXu
Ball Memory Train your Brain Complete Project http://u3d.as/jUz
LED Blinker Notifications for Android goo.gl/o5pBB3