Jump to content
Aveyond Studios Community
Duffer123

Custom Action - IfStringContains (1st attempt!)

Recommended Posts

@Ant,

Here goes nothing.  My first attempt at a Custom Action.  I've just (I hope) attached the relevant folders and two c# files.

I'm not sure what to do with the comparison variable.

Basically designed to return a bool true if value1 string contains value2 string.

Can you review and let me have some feedback?  If possible, heavily comment my code...?

thanks...

 

p.s. - I'd add a Tag for posts relating to 'Custom Action'.... ;)

HeroKit - Custom Hero Action - IfStringContains.unitypackage

Share this post


Link to post
Share on other sites

Works like a charm. I had to make two changes though:

In IfChangeStringFields.cs, I changed 4 to 5 on line 24:

  • ActionCommon.CreateActionFieldsOnHeroObject(heroAction, 5);

Unity Package didn't come with the Hero Action file. I created one and connected it to the CS files.

Share this post


Link to post
Share on other sites

Not stupid at all. The action should only require the 4, but for some reason, it needs at least a 5. I'm going to look into this because I want to know what's up, too.

To create a hero action, follow this tutorial: 

 

 

 

Share this post


Link to post
Share on other sites

@Ant,

Thanks.  May try and create some further Actions now.  Could you post the c# code for the same Hero Action but with also a bool defaulted to false re whether you want the string search to be case sensitive (true) or not.  I can add in the code for the case insensitive bit if you like.  Will really help.  Pls comment it as much as poss thx.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×