Playmaker Forum

PlayMaker Updates & Downloads => Share New Actions => Topic started by: Deek on July 14, 2017, 05:59:34 PM

Title: ...just another big Custom Action collection (A-L)
Post by: Deek on July 14, 2017, 05:59:34 PM
________________________________________________________

The majority of my actions is now on the Ecosystem (https://hutonggames.fogbugz.com/?W1181), making this
topic the hub for all related remarks, suggestions and problems. ________________________________________________________

Link to second half: http://hutonggames.com/playmakerforum/index.php?topic=18460.0 (http://hutonggames.com/playmakerforum/index.php?topic=18460.0)


Since I work on a somewhat larger project for ~3 years I encountered all kinds of challenges to overcome and often times the default- and ecosystem-actions, even though large in numbers, couldn't suffice for all those hurdles.

That's why I had to help myself out and create or modify existing actions which I'd like to share with this community, because without PlayMaker and people contributing additional functionalities I wouldn't have even come close to an almost complete game.

Most of them can be found in the Ecosystem (Unity 5 and up), but for the ones that aren't feasible for that of if you use an earlier version you'd have to skim through my GitHub Repository and install them manually: https://github.com/justDeek/Useful-Unity-Utilities (https://github.com/justDeek/Useful-Unity-Utilities)

I will still add more actions when I see the need for them. If you have any questions or want an action that works in a similar fashion to the prevalent ones, ask right ahead.
If you found any errors or room for improvement, you can also point those out. Any feedback is heartily welcome.


Summary of all currently included actions (their purpose can be derived from their name or action-description):

Ecosystem
Action Name
Usefulness
AnimateVariable:
Ease Int★★★
Animator:
Get Animator Runtime Controller★★
Set Animator Runtime Controller★★
Applications:
Is On Platform Event★★★
Array List:
Array List Contains Name★★★
Array List Get Length★★★★★
List GameObjects Inside Collider★★★★★
List GameObjects Inside Collider2D★★★★★
Array:
Array Get Random Advanced★★
Array Operator★★★
Audio:
Int Switch AudioClip★★★★
Get AudioProgress★★★★★
Get AudioClip Length★★★
Get AudioClip Name★★ (Editor only)
Camera:
Collider Is Visible★★★★
Collider2D Is Visible★★★★
Color:
Compare Colors★★★★
Device:
Get Device Linear Acceleration★★ (untested)
Get Device Roll Custom★★★ (untested)
Swipe Gesture Event Advanced★★★★
Enum:
Enum Get Random★★
Get Enum As Array★★★★
Random Weighted Enum★★★
GameObject & UnityObject:
Activate Components★★★★
Activate Game Objects★★★★★
Activate Game Objects Advanced★★★★
Destroy Children★★★★
Enable Children★★★★
Enable Children In Range★★★★
Find Children★★★
GameObject Compare Multi★★★★
GameObject Keep Active★★★★★
Get Child Count Advanced★★★★
Get GameObject Sibling★★★★★
Get Last Child★★
Get Multilevel GameObject★★★★★
Get Object Name★★★
Has Sibling★★★★
Set GameObject If Not Null★★★
Toggle Component★★★★
Toggle GameObject★★★★
Logic:
Convert Int To Letter★★★★
Float Compare Range★★★★
Int Compare Range★★★★
Int Sign Test★★★
Int Switch Advanced★★★ (similar to existing action)

The rest of my collection can be found on this post here (http://hutonggames.com/playmakerforum/index.php?topic=18460.0).

Notes:
- Third Party actions and the like (e.g. NGUI, GDE, ...) aren't on the Ecosystem (yet), since they are planned to be bundled in a package (like the uGUI action-package for example), which then would be put on the Ecosystem, rather than polluting it with each single actions only a small group of users can use
- the rest of the actions not put on the Ecosystem are either not really useful/interesting for most, only change a little bit of an already existing action, are not tested sufficiently or there is already a similar action available
- the actions are available & supported for Unity 5 and up, because that's the version I mainly use and tested them on, meaning that most if not all of them are likely compatible with earlier Unity versions; but unless there are several people demanding it, it wouldn't be worthwile for me to test them on and provide them for earlier versions (namely Unity 4)

Edit:
|15.07.17|:
- Added: Direct-Download Links since you can't download single files in GitHub
|19.07.17|:
- Added: Actions "Countup Timer", "Swipe Gesture Event Advanced" & Custom Menu options to quickly change between scenes with shortcuts
|21.07.17|:
- Added: GDE-Actions: "GDE Add Float", "GDE Add Int", "GDE Add String", "GDE Multiply Float", "GDE Multiply Int"
- Fixed: GitHub Screenshot-Previews, they should all be visible now
|02.08.17|:
- Added: "Activate Multiple Components" and several GDE-related Actions
|28.08.17|:
- Added: "GDE Find Item By Value", "NGUI Tools Destroy Multi", "Enum Get Random", "Get Enum As Array", "Random Weighted Enum", "Random Weighted Vector3"
|09.10.17|:
- Added: "NGUI Set Sprite Size", "NGUI Set Widget Color", "Get -" + "Set Runtime Animator Controller", "Get AudioClip Length", "Get Audio Progress", "Int Switch", "Set Position Multi", "Debug Variable On Screen", "Send Event Random Delay", "Send Event Set Multi"
- Re-arranged how the list is represented in this post
|09.12.17|:
- Added: "Random Float On Slope", "Random Point On Slope"
- Updated: "Countup Timer" (now supports to pause the timer, reset and restart on enter),
                  "Debug Variable On Screen" (added option to change the font size)
- Fixed: "Destroy Children"
- Re-worked: "GDE Create Item" (removed the convenient custom inspector that showed which Schemas are available, because it brought more harm than good, but at least it works now better and is more performant)
If you still have the "GDECreateItemInspector.cs" file, remove it when you want to use the new "GDE Create Item" script
|23.12.17|:
- Added: "Compare Colors"
- Started uploading most of these onto the Ecosystem (Unity 5 and up)
- Adjusted the list of actions to indicate which action can now be found on the Ecosystem
- Sorted certain actions into better matching categories
- Removed: "Set Sprite Color Custom" and "Remove Fullscreen Color"
|26.12.17|:
- Added: "Follow Mouse 2D"
- Re-worked: "Activate Game Objects" (a re-work of the quite deprecated "Activate Multiple Game Objects" with additional options), "Activate Components" (a better version of "Activate Multiple Components", in the same vein as "Activate Game Objects")
- Created info-banner at the top of this post
|30.12.17|:
- Updated: "NGUI Set Sprite Multiple" (added required OnPreprocess() prerequisite for PlayMaker 1.8.5 and up)
- Re-worked: "Set Positions" (previously "Set Positions Multi", added ability to set each GameObject's position individually (next to setting them all to one as initially intended), as well as the options to choose the update type)
|19.01.18|:
- Re-worked: "Send Events" (previously called "Send Event Multi" and was fairly limited+threw an error when the event, even if global, wasn't used by the current FSM)
- Removed: direct download links since most of the actions are on the Ecosystem anyway and it's one system less that I'd have to maintain whenever I add/update any script
|04.02.18|:
- Added: "Nav Mesh Agent Move To", "Get Child Count Advanced", "Float Compare Range", "Int Compare Range"
|10.03.18|:
- had to split this post in half because of max char limit
|30.03.18|:
- Added: "Activate Game Objects Advanced", "Game Object Keep Active", "Get Last Child", "Toggle Component", "Toggle Game Object", "Reset Transforms", "String Append", "String Remove"
|13.04.18|:
- Added: "Enable Fsms", "Disable This FSM", "Restart This FSM", "Ease Int",  "Get Rotation Add Offset", "Nav Mesh Agent Get Area Mask", "Ngui Label Set Text Advanced"
- Re-worked: "List Game Objects Inside Collider", "List Game Objects Inside Collider 2D" (both contained a restriction that didn't allow to filter by the 'Untagged'-tag), "Get Position Add Offset", "Get Scale Add Offset" (the variable 'Apply Offset to GO' now allows for a direct GameObject to apply the offset to a different GameObject than the specified one; also added the selection of the update type), "Reset Transforms" (now allows to specify which part of the transform (position, rotation and/or scale) to include or exclude)
|24.06.18|:
- Added: "Array Get Random Advanced", "Set GameObject If Not Null", "Random Point Between GameObjects", "Get GameObject Screen Position", "Random Wait Around Offset", "GDE Float Compare", "GDE Int Compare", "GDEResetItem", "GDE Schema Get Next Item"
- Re-worked: "Send Event Set Multi" (added 'Enable' and made 'Send Event' optional), "Send Event Set Value" (added 'Enable'), moved the Item and Field Names of my GDE actions to the top
|11.01.19|:
- Added: "Get Children", "Array Add GameObject If Enabled", "Array Add If Empty", "ArrayIsEmpty"
- Re-worked: "Array List Contains Name" (fixed comparison of Objects, added option to check for identical entries or ones that only contain the given name)
|24.09.19|:
- Added: "Find Children", "Convert Int To Letter", "Get Percentage Int", "Get Gravity 2d Scale", "Random Characters", "Sprite Get Name"
- Updated: "Activate GameObjects", "Activate GameObjects Advanced", "Get GameObject Sibling", "Get Multilevel GameObject"
Title: Re: ...just another big Custom Action collection
Post by: tcmeric on July 14, 2017, 11:04:11 PM
Awesome, looks like some great actions! Thank you for posting.
Title: Re: ...just another big Custom Action collection
Post by: djaydino on July 15, 2017, 12:30:27 PM
Hi,
Wow a nice bunch of actions, i will certainly check them out.
May i add some of those on the Ecosystem?
Title: Re: ...just another big Custom Action collection
Post by: Deek on July 15, 2017, 02:10:33 PM
Hi,
Wow a nice bunch of actions, i will certainly check them out.
May i add some of those on the Ecosystem?
Sure thing, do as you please!
The GitHub Repository also contains all the preview pictures for the actions in the folder "Screenshots" if you want to include them for the Documentation-Button (the ?-Symbol on actions in the Ecosystem).

But I'm still unclear how the actions you choose to use could be updated if I improve or modify something inside of them... by replying to this post or is there another way?
Title: Re: ...just another big Custom Action collection
Post by: djaydino on July 16, 2017, 01:56:01 AM
Hi,
Thx i will post when i added some actions.
(might take a while :) )
Title: Re: ...just another big Custom Action collection
Post by: craigz on December 06, 2017, 11:51:27 AM
Hi Deek!

Just wanted to say this is an awesome list - and thanks for tuning me in about Game Data Editor! It's so crazy useful! :D

I am getting some errors specifically on the 'Destroy Children' action, any ideas for a quick fix?

Code: [Select]
UsefulUnityUtilitiesMaster/Custom PlayMaker Actions/GameObject & UnityObject Customs/DestroyChildren.cs(30,18): error CS1061: Type `UnityEngine.Transform' does not contain a definition for `DestroyChildren' and no extension method `DestroyChildren' of type `UnityEngine.Transform' could be found. Are you missing an assembly reference?
Let me know, these have been super useful :)

-craigz
Title: Re: ...just another big Custom Action collection
Post by: Deek on December 09, 2017, 09:56:03 AM
Whoopsie... Yeah that action used an extension method from NGUI which I haven't noticed (though it would be one from Unity's transform class).
Anyway, fixed it so it should work fine now. If you encounter further problems, please let me know; also I'm glad you find these helpful.
Title: Re: ...just another big Custom Action collection
Post by: jellyam on December 09, 2017, 11:09:39 AM
thanks man, downloadign right now, can't to check 'em out
Title: Re: ...just another big Custom Action collection
Post by: craigz on December 09, 2017, 09:04:57 PM
Wahoo! Awesome, thank you so much Deek! You rock :D was it updated via Github? Just pulled the latest and still no dice! D:
Title: Re: ...just another big Custom Action collection
Post by: Deek on December 10, 2017, 06:35:31 AM
The updated version is available on both ends.
The direct download links lag a bit behind since I usually only sync my changes at the end of the day or the morning after, but I will likely soon have a better way of providing these (or maybe push these to the Ecosystem).

For your convenience I put the updated script as an attachment to this post, so you don't have to skim through the folders again ;)
Title: Re: ...just another big Custom Action collection
Post by: craigz on December 11, 2017, 09:10:51 PM
Dahhhh! Deek you're the best :D thank you for making things so convenient :P

And heck yeah! Would love to see some of them on Ecosystem, they're so useful! Because it's easy to tell they were made to help actually MAKE a game, rather than just a mish mash of just cool utilities :P

**EDIT**
Oh noes! Getting this on reimport!

Code: [Select]
Assets/PlayMaker Custom Actions/UsefulUnityUtilitiesMaster/Custom PlayMaker Actions/GameObject & UnityObject Customs/DestroyChildren.cs(30,18): error CS1061: Type `UnityEngine.Transform' does not contain a definition for `DestroyChildren' and no extension method `DestroyChildren' of type `UnityEngine.Transform' could be found. Are you missing an assembly reference?

-craigz
Title: Re: ...just another big Custom Action collection
Post by: djaydino on December 12, 2017, 03:37:45 AM
Hi Deek.
Do you have some experience with github / sourcetree?

You can find several videos explaining how to use them, here's one of them :


Once you've got this setup you can get access by asking jean.

Once you got a repository the best thing to do is to open it with unity (as a project) and install playmaker.
For u5 repo's you need to install unity 5.6.4, for u4  repo's you need to install 4.7.2
you can install multiple versions on 1 machine.
rename the unity folders to (for example Unity4 , Unity5 , unity2017, unityBeta)

You can also drop the actions directly in the repo custom action folders but it is recommended to do it inside unity for minimizing errors.

In your action scripts you need to add :
Code: [Select]
// (c) Copyright HutongGames, LLC 2010-2017. All rights reserved.
// Author : 'Your Playmaker username'
// supportUrl : 'url to the playmaker forum thread when available'
/*--- __ECO__ __PLAYMAKER__ __ACTION__ ---*/
The last line is mandatory, else the ecosystem won't find the action.

I had a lot of work going on so i did not have the time yet to check them out and add them to the Ecosystem, sorry for that.

For the 3rd party actions, maybe it is best to place then in a bundle package.
We will provide you an asset we are working on to simplify doing this.

Let me know if you need some help.
Title: Re: ...just another big Custom Action collection
Post by: Deek on December 12, 2017, 01:14:08 PM
@craigz
Thanks for your kind words.
Yep, the line that causes the error was still in the updated version, even though I could have sworn that I removed it. Anyway, NOW there is the fixed version in the links and in this attachment, sorry for that.  ::)

@djaydino
The fact that I'm currently using GitHub to share these actions should show that I at least have the basic understand on how to handle repositories. :)

Though, for the u5 repo, does it necessarily need to be Unity 5.6.4, because I currently use 5.6.1f1.

Also since I've seen you guys trying to explain the process on several posts individually, why not make a sticky in the 'Share New Actions' section with a more exhaustive and universal explanation which you can then reference/link to when you need to explain it to someone again.
For example, this post on that topic also reveals additional info that would be worth mentioning:
(https://i.imgur.com/nB0oUGgl.png)

And it might be redundant to rewrite that every time; just a suggestion.
Title: Re: ...just another big Custom Action collection
Post by: djaydino on December 12, 2017, 04:40:26 PM
Hi.
Quote
The fact that I'm currently using GitHub to share these actions should show that I at least have the basic understand on how to handle repositories. :)
Sorry i was doing several things at the same and not thinking straight lol.

Quote
Though, for the u5 repo, does it necessarily need to be Unity 5.6.4, because I currently use 5.6.1f1.
after you tested on your version you can copy paste them to the repo as i think there will be version issues.
But it's best to ask jean

Quote
Also since I've seen you guys trying to explain the process on several posts individually, why not make a sticky in the 'Share New Actions' section with a more exhaustive and universal explanation which you can then reference/link to when you need to explain it to someone again.

Yes indeed, i am planning to make a wiki page for it.
Title: Re: ...just another big Custom Action collection
Post by: Voa on January 13, 2018, 08:13:36 PM
Hi!

Awesome actions, thank you! I'm already using a couple of them, will check others after seeing this post. I found them in the Ecosystem, specifically looking for Send Event Multi.

But, I got an error (on Send Event Multi). Idk if it is already reported or not, but the action does not recognize Global Events, which is really strange given its purpose! I will leave a screenshot attached to better describe.

I tried to fix it myself, but was limited by my skills :P
Would you know why this happens, and how it can be fixed?

Ah, and another problem is that it does not have the option to send to children :(
Title: Re: ...just another big Custom Action collection
Post by: Deek on January 19, 2018, 08:48:18 PM
@Voa
Thanks for your feedback and sorry for the late reply (busy workweek).
I've noticed that error message already back then when creating that action but started to ignore it, since there were a few ways to circumvent it; though I knew that this was anything but ideal.
That's why I looked into it (and also because of your "reminder" :P ), created a better version and found out a few things on what caused it.

tl:dr
You can now get the improved and working action "Send Events" from the Ecosystem, should likely convert any 'Send Event Multi' actions to that and delete the SendEventMulti.cs from your Custom PlayMaker Actions folder (or keep it if you want).

Details:
The problem was, that the default 'Send Event' action uses an FsmEventTarget (Self, Broadcast, ...) and an FsmEvent variable, which get linked internally, so that depending on the selected EventTarget, the Event either only shows global variables or also local ones and automatically checks if the selected target does have the global event or not.
Since I was using an FsmGameObject[] (-Array) instead of FsmEventTarget in my "Send Event Multi"-Action, the FsmEvent variable had no target at compile time to check against, thus it always showed all available events and threw an error if it couldn't find a matching event/transition by default.

First I created another version with an FsmEventTarget[] instead of the FsmGameObject-Array, but that also didn't seem to work and made everything more bloated + you had to click more often to set up even one entry.

After that I thought of letting the user only define the EventTarget once and have him be able to select several of these targets, but since I couldn't directly manipulate the FsmEventTarget class itself and intervene it's functionality, I had to create my own version of it by creating a custom inspector that mimics the default functionality by only showing the relevant fields depending on the selected target type and hooked up matching functionality in the actual action.
I've added even more options than the standard version provided, like only sending events to FSMs with the right FSM-name, searching for SubFSMs by their name and hiding/disabling the delay field when either Broadcast All or Every Frame is selected.
But even after that, the error still showed up and I couldn't find a way to tell the FsmEvent that it should only show global events when a certain EventTarget was selected, until I found that someone already posted a similar problem on this forum (here (http://hutonggames.com/playmakerforum/index.php?topic=2952.0)).
I adapted that "temporary" fix (since it seems like he didn't add that NoErrorCheck-attribute) to get the FsmEvent into thinking that there is an FsmEventTarget available which won't get drawn by my custom inspector and now it stops showing that pesky error.

So the final result isn't 100% perfect, but at least way better than my inital attempt.
Title: Re: ...just another big Custom Action collection
Post by: craigz on March 08, 2018, 03:02:32 PM
Hey @Deek!

Saw you asking questions on the Unity Forum for Game Data Editor :)

Gotta say, I discovered the asset from your actions for it here a few months back, and seriously it is SO awesome :) thanks for taking the time to write all these actions for it. It's made my life so much easier :D

Also! Did you end up getting the delete item action to work you were talking about with Celeste? I'm looking into reworking my player inventory and that would be huuugely useful xD

best,

craigz
Title: Re: ...just another big Custom Action collection (A-L)
Post by: Deek on March 10, 2018, 09:25:20 AM
@craigz

Thanks for your kind words.

I was actually spending the last few weeks creating a helper class for GDE containing various useful functions for the GDE PlayMaker actions, because there was a lot of redundancy in them (unnecessary duplicate code); meaning that you will also need that script to make most of the other actions work, but also that there are now even more actions for GDE available :)

Additionally, I've combined the Add Int, Add Float, Multiply Int and Multiply Float into Float Operator and Int Operator, but you can still use the old versions in your project if you want.

With Celeste's help I also figured out how to remove items, though I'm not quite convinced that it works 100% of the time, that's why it would be great if you could also test the action "GDERemoveItem". To debug the ModifiedData dictionary, I've also created the GDEDebugData action, to make that process more simple.

Currently, there's also a problem with GDECreateItem not applying the field values, so you should stick to the previous version until I fix that (and GDEFind is currently not finding any Field Types, but that's a minor issue). If you run into any problem with the new actions, don't hesitate to notify me.

P.S.: Because of the character limit on this topic I had to split it in half, which means that the third party section is now on this post (http://hutonggames.com/playmakerforum/index.php?topic=18460.0) if you're looking for updates, because I'm not done with creating actions for GDE yet :D


Edit (important):
Now I know why I wasn't quite convinced: In order to completely remove an Item from the GDE data it's for some reason also necessary to remove the Item from the DataDictionary, not just the ModifiedData. I adjusted the function so now it removes any Item correctly 100% of the time.
I also bundled the current version of my GDE actions so that you (or anyone interested) doesn't need to download my whole repo or has to copy over each single script individually (see attachments).

Edit 2:
"also"-Counter: 8 :P
Title: Re: ...just another big Custom Action collection (A-L)
Post by: craigz on April 19, 2018, 03:17:28 PM
Deek!

I am SO sorry again for the late response, I forgot to click notify on the thread xP

Ahh! :D I'm so excited to play with these actions, thanks for making an operator for the float/int interactions as well, I had ended up building out a few of them that I needed, but combined is WAY more practical :)

Saw your edit change on the other topic, so I'll be sure to download the actions from your repo instead. So, SO useful :D

-craigz


Title: Re: ...just another big Custom Action collection (A-L)
Post by: craigz on June 21, 2018, 05:05:50 PM
Hey Deek! :D

Just wanted to give a shout, I'm having issues with the (more) updated version of GDE Bool Test, for some reason if I point it towards an older GDE bool I've created, it works no problem, but any of my new ones I've made I get a 'InvalidCastException' from xD

Any ideas? :/

-craigz

*EDIT: I'm primarily using the action in a template, but am getting the issue in and out of a template.

Code: [Select]
InvalidCastException: Cannot cast from source type to destination type.
HutongGames.PlayMaker.Actions.GDEBoolTest.CheckGDEBool () (at Assets/PlayMaker Custom Actions/UsefulUnityUtilitiesMaster/Custom PlayMaker Actions/_ThirdParty/GDE Customs/GDEBoolTest.cs:56)
HutongGames.PlayMaker.Actions.GDEBoolTest.OnEnter () (at Assets/PlayMaker Custom Actions/UsefulUnityUtilitiesMaster/Custom PlayMaker Actions/_ThirdParty/GDE Customs/GDEBoolTest.cs:40)
HutongGames.PlayMaker.FsmState.ActivateActions (Int32 startIndex) (at C:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:205)
HutongGames.PlayMaker.FsmState.OnEnter () (at C:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:175)
HutongGames.PlayMaker.Fsm.EnterState (HutongGames.PlayMaker.FsmState state) (at C:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2695)
HutongGames.PlayMaker.Fsm.SwitchState (HutongGames.PlayMaker.FsmState toState) (at C:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2642)
HutongGames.PlayMaker.Fsm.UpdateStateChanges () (at C:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2570)
HutongGames.PlayMaker.Fsm.UpdateState (HutongGames.PlayMaker.FsmState state) (at C:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2711)
HutongGames.PlayMaker.Fsm.Update () (at C:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:1934)
HutongGames.PlayMaker.Actions.RunFSMAction.OnUpdate () (at Assets/PlayMaker/Actions/RunFSMAction.cs:55)
HutongGames.PlayMaker.FsmState.OnUpdate () (at C:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:265)
HutongGames.PlayMaker.Fsm.UpdateState (HutongGames.PlayMaker.FsmState state) (at C:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2710)
HutongGames.PlayMaker.Fsm.Update () (at C:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:1934)
PlayMakerFSM.Update () (at C:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/PlayMakerFSM.cs:539)
Title: Re: ...just another big Custom Action collection (A-L)
Post by: craigz on June 22, 2018, 10:48:51 PM
Sorry for the double post :) also wanted to ask if you know of any way with the current actions to reset a particular item at run time? (all of its fields) Rather than having to manually reset them all xP

I have a feeling there might already be a way and I'm overlooking a term, but I though I should ask :D

Thanks again Deek for all these rad actions! :D

-craigz
Title: Re: ...just another big Custom Action collection (A-L)
Post by: Deek on June 24, 2018, 01:32:55 PM
No problem.
To reset all fields of an Item I've made a GDEResetItem action that you can get from my Repo or the attachments.
This one (and the ResetFields action) removes the item fields from the ModifiedData dictionary (changed data), unlike the RemoveItem action that also clears it from the DataDictionary (persistent data).

For the GDEBoolTest problem, please replace your GDEHelpers.cs script with the version in the attachments, which should work more reliable (because I reverted back to using the GDEGetBool approach to retrieve bool variables).
The InvalidCastException also often only shows up when the searched Item or Field couldn't be found, so another thing to make sure when such an error pops up is that the given search parameters are correct and that the Item/Field exists at all ("InvalidCast" because it tries to convert the retrieved object to a boolean and if the retrieved result is null/non-existent it throws this exception).
Title: Re: ...just another big Custom Action collection (A-L)
Post by: craigz on June 25, 2018, 12:20:23 AM
AH! :D

Deek you are seriously the best :) you make me feel invincible with GDE! :D

So a huge thank you for the updates and the scripts, it really means a lot to me. I'm pulling them in now.

Good call on double checking for existing an Item/Field, always my first gut call :) good to know that's what the InvalidCastException is usually meaning.

best,

craigz
Title: Re: ...just another big Custom Action collection (A-L)
Post by: Thore on September 06, 2018, 07:05:29 PM
Thanks for the actions! I also found a bug in one of them.

SendEventSetValue.cs
Bug: It works exactly once, then stops working. I suspect that it doesn't reset properly.

In the screenshot attached you see the setup. The top action is SendEventSetValue.cs and this produces the problem as described. The two lower actions do the same, but by conventional methods (which works). I only put them together to show the setup.

Hope that helps :)






Title: Re: ...just another big Custom Action collection (A-L)
Post by: Deek on September 07, 2018, 04:50:44 PM
@Thore
I tried to replicate it, but it always seemed to work for me. I've also used that action in one of my projects for a prolonged time without noticing anything like that.
One thing you could do is to update the action in the Ecosystem, that should reimport it and might fix this behavior.
If it still doesn't work, could you please test that action in simplified setup, to make sure that the problem lies within the action and not something else?
Title: Re: ...just another big Custom Action collection (A-L)
Post by: szomaza on October 28, 2018, 06:25:52 AM
Thanks for the actions!

I noticed that the "Get Multilevel GameObject" is a bit buggy.
- With 0 it gets the owner as it should,
- With -1 it does not do anything, (something buggy here and then all the rest are offset)
- with -2 it gets the 1st child,
- with -3 it gets the 1st child of the 1st child,
- ...

Br,
szomaza


Code: [Select]
// License: Attribution 4.0 International (CC BY 4.0)
/*--- __ECO__ __PLAYMAKER__ __ACTION__ ---*/
// Author : Deek

using UnityEngine;

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.GameObject)]
[HelpUrl("http://hutonggames.com/playmakerforum/index.php?topic=15458.0")]
[Tooltip("Get the Game Object and name of a higher parent or lower child specified by an index.")]
public class GetMultilevelGameObject : FsmStateAction
{
[RequiredField]
[Tooltip("The GameObject to start from.")]
public FsmOwnerDefault startingFrom;

[Tooltip("How many 'Directories' to go up or down. For example '2' would be the grandparent of the GameObject this FSM is attached to, '3' the parent of that one ... and so on. 0 returns the Owner. Anything below 0 goes in the other direction (-2 = first Child of the first Child). You can also set a very high number to definitely get the root.")]
public FsmInt index;

[UIHint(UIHint.Variable)]
[Tooltip("The final GameObject it reached.")]
public FsmGameObject storeResult;

[Tooltip("The Name of the final GameObject it reached.")]
public FsmString storeResultName;

[Tooltip("Follow the path it takes (throws Debug.Log's for every GameObject it passes). If there are several Log entries with the same GameObject, it means that the given index is higher than the GameObject has parents or lower than it has children.")]
public FsmBool debug;

public override void Reset()
{
startingFrom = null;
index = 1;
storeResult = null;
storeResultName = null;
debug = false;
}

public override void OnEnter()
{
var go = Fsm.GetOwnerDefaultTarget(startingFrom);
if(go != null)
{
//Get Owner
if(index.Value == 0)
{
storeResult.Value = Owner;
storeResultName = storeResult.Value.name;
if(debug.Value == true)
{
Debug.Log("GetMultilevelGameObject - Owner: " + Owner);
}

}

//Get ascending parent
if(index.Value > 0)
{
for(int i = 1; i < index.Value; ++i)
{

go = go.transform.parent == null ? go : go.transform.parent.gameObject;

if(debug.Value == true)
{
var j = i + 1;
Debug.Log("GetMultilevelGameObject - Parent " + j.ToString() + ": " + go.transform.gameObject.name);
}

storeResult.Value = go;
storeResultName = storeResult.Value.name;
}
}

//Get descending Child
if(index.Value < 0)
{
for(int i = -1; i > index.Value; i--)
{
go = go.transform.GetChild(0) == null ? go.transform.gameObject : go.transform.GetChild(0).gameObject;

if(debug.Value == true)
{
//Invert and add 1 to current Index
var j = (i * (-1)) + 1;
Debug.Log("GetMultilevelGameObject - Child " + j.ToString() + ": " + go.transform.gameObject.name);
}

storeResult.Value = go;
storeResultName = storeResult.Value.name;
}
}

}
//If startingFrom is Null
else
{
storeResult.Value = null;
storeResultName = "None";
if(debug.Value == true)
Debug.Log("GetMultilevelGameObject - NullReferenceException: 'Start From' is null");
}
Finish();
}
}
}
Title: Re: ...just another big Custom Action collection (A-L)
Post by: Deek on October 28, 2018, 05:59:26 PM
Yeah, I wasn't that thorough on that one. I initially created it to find certain parent GameObjects by level index and searching the other way was more of a by-product.

I now re-worked it, so that it gets the actual GameObject at the given index and that it stops when the index is too high or too low (also adjusted how the debug messages are formated). Additionally, I added the option to go through the children recursively or only search through the children of the starting GameObject.
You can get the new version by updating the action in the Ecosystem.

Thanks for reminding me to fix this action, as I kept putting it of.
Title: Re: ...just another big Custom Action collection (A-L)
Post by: Macol90 on November 02, 2018, 02:59:10 PM
I just want to thank you for these Actions! I've used several of them. Other than Jean I didn't realize anyone added so many! I just want to say thanks for all your hard work, and your effort hasn't gone unnoticed!

Good luck with the project!
Cheers!
Mike
Title: Re: ...just another big Custom Action collection (A-L)
Post by: Deek on November 02, 2018, 03:30:40 PM
Thanks a lot, man!
I appreciate your appreciation :D
Title: Re: ...just another big Custom Action collection (A-L)
Post by: jeanfabre on January 14, 2019, 02:16:12 AM
Hi Deek,

 Thanks for your contributions.

 one thing: StringAppend is a duplicate, it exists already in PlayMaker built in actions, I renamed to StringAppend2.

Always make sure you don't push actions on a repository that has errors. Simply run that repository with Unity to make sure all your actions compiles, the you can push/.

Bye,

 Jean
Title: Re: ...just another big Custom Action collection (A-L)
Post by: Deek on January 14, 2019, 10:41:01 AM
@Jean

Whoops, sorry about that one.
Though I've added the String Append action at the end of March 2018, is the built-in String Append action new or has this gone unnoticed for that long?
Title: Re: ...just another big Custom Action collection (A-L)
Post by: jeanfabre on January 15, 2019, 07:48:05 AM
Hi,

 seems so :)

 Bye,

 Jean
Title: Re: ...just another big Custom Action collection (A-L)
Post by: Twood on August 05, 2019, 07:40:15 PM
@Deek

is there a way to remove the error from Get Game Object Sibling if there's no sibling found? I don't always want it to find something anyway... i.e. it's checking cards to the left and right and there might not be one there. Anyway what I want to do with the cards works fine I can give a sort of spreading and zooming effect with cards as I'm mousing over to highlight the current one, but it still throws an error up in the console because that action doesn't like a null result.
Title: Re: ...just another big Custom Action collection (A-L)
Post by: Deek on August 06, 2019, 03:49:09 AM
Hey Twood,
I've adjusted the action a bit, so that it checks if the sibling-index is out-of-bounds and added a Not Found Event option, so that it optionally sends an event if that happens.
I can only test it when I'm back home, but if you're eager to try it out in the meantime, you can find the action in the attachments.
I will reply later if I found any errors, but it should work just fine.
Title: Re: ...just another big Custom Action collection (A-L)
Post by: Twood on August 06, 2019, 12:31:22 PM
@Deek

Thanks for the response! Tried that new code just now and I am getting an error from it:

Assets\PlayMaker Custom Actions\GameObject\GetGameObjectSibling.cs(45,7): error CS0246: The type or namespace name 'Transform' could not be found (are you missing a using directive or an assembly reference?)
Title: Re: ...just another big Custom Action collection (A-L)
Post by: Deek on August 06, 2019, 03:51:58 PM
@Twood

Oh yea, a common mistake. At least I know had the time to test the action and managed to further improve the action:
- fixed saving the result name in the 'Store Result Name' option
- made the 'Store Result Name' option only allow FsmVariables to store the name in
- the 'Not Found Event' is now also raised if the parent is null, speak if trying to get the sibling of a root GameObject

Updated version is in the attachments, should be working fine now. If you find any other errors or wan't another action to behave differently, please let me know.
Title: Re: ...just another big Custom Action collection (A-L)
Post by: Twood on August 06, 2019, 05:19:06 PM
Most appreciated! Works great! ;D
Title: Re: ...just another big Custom Action collection (A-L)
Post by: dsimovski on September 06, 2019, 11:22:19 AM
Hi,

thank you for the great Actions!

I have a problem with Activate Gameobjects Advanced, i can only run it once. When i return with a global Transition the the State it doesnt do anything.

Any Ideas ?

Yours
Damir
Title: Re: ...just another big Custom Action collection (A-L)
Post by: djaydino on September 06, 2019, 02:28:44 PM
Hi.
Can you show an image of the action setup.

IF it is set to owner the fsm will be disabled and a global transition will not be received.
Title: Re: ...just another big Custom Action collection (A-L)
Post by: Deek on September 08, 2019, 04:21:03 PM
Nah, the fault is on my end..
For the ability to reset the the changed GameObjects on exit I had to keep track of what objects had been altered but forgot to reset that list in OnEnter. Fixed version is in the attachments.

Thanks for pointing out that error and sorry for the inconvenience.
Title: Re: ...just another big Custom Action collection (A-L)
Post by: MarkD on October 07, 2021, 10:42:49 PM
Hi there - I'm using an action from your list and I believe it's no longer working and was hoping someone might be able to help find a fix for it.

The action is Int Switch Audio Clip.

I believe what this action is doing is that it reads the int variable and compares it to the int values for each audio clip.  When it finds a match, it assigns that match to the result variable.


For example, I set up a 2 Audio clip Int switch where 1 = audioClip01 and 2 = audioClip02.  Then, if the Int = 1, it sets audioClip01 as the result variable. 

That's cool because I want to assign that result to an item at runtime.

However, when I run the game and look at the action in the state, the "found" audioClip that I assigned is changed to a empty drop down selection and the result variable is empty.  When I stop the editor, it returns to normal.

Does that make sense? 
Title: Re: ...just another big Custom Action collection (A-L)
Post by: Deek on October 08, 2021, 04:45:12 AM
Oh hi Mark :)

I think the problem lies in line 59 where "result = assignedAudioClip;" should rather be "result.Value = assignedAudioClip;", because it's assigning the clip to an fsm object, which requires the .Value for assignments. Guess I didn't notice it, since it sometimes also works the other way around.

You can add the fix yourself or download the script from the attachments and see if it fixed the problem.

Greetings
Deek
Title: Re: ...just another big Custom Action collection (A-L)
Post by: MarkD on October 08, 2021, 08:55:15 AM
Thank you for the quick reply, Deek!

I pulled that into my project but I get a compiler error:

Assets\PlayMaker Custom Actions\Audio\IntSwitchAudioClip.cs(59,21): error CS0029: Cannot implicitly convert type 'HutongGames.PlayMaker.FsmObject' to 'UnityEngine.Object'
Title: Re: ...just another big Custom Action collection (A-L)
Post by: Deek on October 08, 2021, 10:03:56 AM
oh, duh. I haven't checked what variable type the assignedAudioClip variable is and it's an FsmObject array. So that value is also read by adding .Value, which means that the line should be:
Code: [Select]
result.Value = assignedAudioClip[i].Value;Sorry 'bout that. I haven't used PlayMaker in a while and didn't test the action :P
Fixed version again in the attachments.

Have a great one!
Deek
Title: Re: ...just another big Custom Action collection (A-L)
Post by: MarkD on October 08, 2021, 01:45:12 PM
That did the trick!  Thank you!

And I totally caught your Oh hi comment, haha. :)
Title: Re: ...just another big Custom Action collection (A-L)
Post by: Broken Stylus on April 25, 2022, 11:04:38 AM
Hi.
It seems Countup timer resets the private float timer to 0f even not set up to be reset on entering the state.
Reset is set to false or none.
This doesn't happen if not using real time.
It looks like
Code: [Select]
timer = FsmTime.RealtimeSinceStartup - startTime;doesn't add time like it should.
Title: Re: ...just another big Custom Action collection (A-L)
Post by: Deek on April 25, 2022, 03:58:38 PM
Hi Broken Stylus,

thanks for finding and pointing out this bug.
I didn't add the previous timer value to the startTime when entering the state and when 'Restart On Enter' is not enabled. I also noticed that enabling the 'Reset' flag doesn't reset the startTimer.

I fixed both in the attached file and did thorough testing of each combination of the options, so it should work now without any flaws.

Greetings
Deek
Title: Re: ...just another big Custom Action collection (A-L)
Post by: Broken Stylus on May 13, 2022, 05:41:47 AM
Oh great!