Jump to content
TrickyHandz

PlayMaker Actions for ProBuilder

Recommended Posts

I figured it would be best to start a new thread for this one.  The discussion of PlayMaker actions for ProBuilder was originally in this thread: [FIXED] mesh filter + spawn.  However, seeing as this may expand into more actions to cover use cases, I thought the topic deserved a new thread to keep everything neatly organized and easy to access.  

 

I believe there should be a set of standards for these custom actions, but as I'm still new to PlayMaker I would appreciate input from anyone else in the community to help establish these rules for making actions that allow ProCore tools to accessed through PlayMaker.  I look at this as a community project, unless no one else is interested in writing code, in which case just tell me what you think would be useful.  Remember that PlayMaker is for runtime code only, so I won't be able to write actions for custom editor behaviors...as far as I know.

 

NOTE:  Code files will be attached to this post, size permitting, with a text extension (.txt).  Simply remove the .txt extension and import the C# file into your project.

 

 

CUSTOM PLAYMAKER ACTION(S)

 

InstantiateProBuilderObject

(NOT NEEDED  AFTER PB v2.3.1f1)

 

FILE INFO:

Name: InstantiateProBuilderObject.cs

Class Name: InstantiateProBuilderObject

Attached here as: InstatiateProBuilderObject.cs.txt

 

PLAYMAKER INFO:

Action Browser Section: ProBuilder

Action Name: Instantiate Pro Builder Object

Action Description: Instantiates a Prefab created from a ProBuilder Object

Action Information:

  • Requires a Prefab to be defined or you get some nice warnings/errors from PlayMaker
  • Allows for assignment of a "SpawnPoint" GameObject.
  • Allows assigning of Vector3 Position for instantiation.  If there is a spawn point defined this is a local offset.
  • Allows assigning of Vector3 Rotation for instantiation.  This overrides the rotation of a spawn point if one is defined.  All Quaternion conversion is handled.
  • All Action variables have Tooltips for quick reference.
  • If only the Prefab is defined it will spawn based on prefabs transform properties.

***** UPDATE : 13 August 2014 ****

 

- Changed references to PlayMaker "Tooltip" attribute to include full namespace declaration "HugtongGames.PlayMaker.Tooltip".  This was causing a conflict after v4.5.x of Unity.  

InstantiateProBuilderObject.cs.txt

Share this post


Link to post
Share on other sites

No problem Karl!  If you, Gabriel or anyone else in the community have suggestions for PlayMaker actions that would be useful just let me know and I'll see about writing them.  Additionally, if anyone in the community has written custom PlayMaker actions for ProCore tools and would like to contribute them to this little project that would be cool too.

Share this post


Link to post
Share on other sites

@Boldee, I'm glad I helped in some way.  

 

Sort of Off-Topic:

I'm learning as I go with PlayMaker right now, but I will say that they have really good documentation.  There are ups and downs to using a visual scripting tool, but I know for a fact that Blizzard used it to help develop HearthStone so it can't be that bad.

Share this post


Link to post
Share on other sites

Lol I'm not sure Blizzard using it is a recommendation or not lol knowing their record for releasing bug ridden games hehe, but yes if it can cut down on manual coding then I'm all for it. I have spent many hours coding in php only to find a nice tool after I had finished that would have helped.

Share this post


Link to post
Share on other sites

The showcase PlayMaker has is pretty impresssive: PlayMaker User Showcase

I have my own feelings about visual scripting vs code...probably because I had to start out with code back when I was modding games.  Visual tools do fill a definite gap in a lot of people's workflow though, just like ProBuilder let's me make level maps with no experience 3D modeling.

Share this post


Link to post
Share on other sites

Need help.  I saved the included script on my unity project, and it resulted in several errors referring to tool tips, and the layout of my unity layout had to be reseted.  It also did not shop either playmaker or probuilder interfaces.  had to delete the cs script for everything to be back to normal :(

 

Any help will be appreciated.

Share this post


Link to post
Share on other sites

Ricard,

 

I'm sorry to hear about your problems with this script.  I have updated the script in the original post to fix the errors you encountered.  Please let me know if the problem is fixed for you.  I verified the error with the "Tooltip" that you mentioned and it is now fixed for all released Unity versions and the latest versions of ProBuilder and PlayMaker from the Asset Store.

 

If you continue to have problems, please post the exact error(s) that are appearing in Unity.

 

Cheers,

Tim

Share this post


Link to post
Share on other sites

Thanks TrickyHandz:

 

I went ahead and tried it and was able to install the script in the interface perfectly.  Yet, When I use it, unity crashes (and pops up the unity error reporting screen).  Perhaps I am using the script incorrectly.

 

1-create an object with  pro builder

2-add playmaker fsm to object

3-on first state, i add the probuilder instatiate action.  (I asume that then i add probuilder behavior after this, but for testing I just added the isntantiate)

4-select the prefab object (the probuilder object to modify)

5-run my scene

 

Result, crash with error reporting.

 

I tried testing in an empty scene, and whne I run it, it loops a crating of unlimited prefabs (but did not crash).  I assume that might be the cause of the crash in my original scene (perhaps out of memory).

 

Anyways, thanks for your help :)

Share this post


Link to post
Share on other sites

Ricard,

 

I think I know what is going on.  The ProBuilder Instantiate action and the ProBuilder function is it built on are used the same way you would use to instantiate a normal game object, except that it calls some background stuff that is needed for ProBuilder objects.  Here is how you should implement this to make it work properly.

 

1 - Create a Probuilder object with Probuilder in your scene.

2 - Create a Prefab from your ProBuilder object (Just drag it from the scene hierarchy to the project view)

3 - Delete the ProBuilder object from your scene.

4 - Attach a PlayMaker FSM to any any object in the scene.

5 - Add the ProBuilder Instantiate Action to the FSM

6 - Select the Prefab you created earlier and assign it to the instantiate action

7 - Run your scene

 

I don't really know what was causing the looping behavior you described, but I would be more than happy to take a look at scene where this is happening so that I can help track down the problem and adjust the action as necessary.  Thanks so much for your feedback on this.

 

Cheers,

 

Tim

Share this post


Link to post
Share on other sites

Hello again.

 

Tried your method and it did not work.  Unity did not crash, but the original object remains, and the instantiated probuild object never materializes.  I was wondering if you would be willing to do a skype with me.  I would screen share so you can see the symptoms and trouble shoot.  I could also pay you a little for your time if needed.

Share this post


Link to post
Share on other sites

Just thought I would let everyone know that the PlayMaker action for instantiate does indeed work without error.  After a bit of trouble shooting on the PlayMaker FSM itself, we were able to get a nice spawning test done for Ricard's project.

Share this post


Link to post
Share on other sites

Hi there,

 

trying to get this script to work but getting an error - "PlayMaker Custom Actions/InstantiateProBuilderObject.cs(57,17): error CS0103: The name `Instantiate' does not exist in the current context"

 

The code it doesn't like is :

 

Instantiate.ProBuilderprefabObjectvPositionqRotation );

 

using latest Playmaker/Probuilder and Unity 4.6.1.p4 on Mac

 

any help would be appreciated, Thanks!

 

~ Jasper.. 

Share this post


Link to post
Share on other sites

Echoing a bit of what Karl said, there isn't a need for ProBuilder.Instantiate anymore.  As such you can use PlayMaker's built-in GameObject Instantiate action.

 

Karl,  I can't seem to find which version of PB removed the need for the custom instantiate method, if you could post that, I will update the original post so to reflect that this action is valid only for that PB version an earlier.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×