playMaker

Author Topic: Clearing a generic list. [SOLVED]  (Read 1092 times)

MAX_POWER

  • Playmaker Newbie
  • *
  • Posts: 40
    • View Profile
Clearing a generic list. [SOLVED]
« on: February 11, 2018, 05:17:20 AM »
I'm using the TriggerEventOncePerObject.cs script and it's using a generic list. (List<GameObject> alreadyHit = new List<GameObject>();)

Is there a way to clear this list with another action in another state? I know it should be as easy as alreadyHit.Clear(); but I don't know how to create an action like that. Or is there a way to already do it somehow? Thanks.
« Last Edit: February 12, 2018, 02:53:02 AM by djaydino »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4317
    • View Profile
    • jinxtergames
Re: Clearing a generic list.
« Reply #1 on: February 11, 2018, 05:38:18 AM »
Hi.
I have added a "Reset" bool where you can place a variable and you can set that bool to true on a different state.
Then when TriggerEventOncePerObject is called again it will check if that bool is true and reset the list + set it back to false.

Can you try if it works as you want?
FOR HIRE:Playmaker/C#

Playmaker Samples <-------------> Easy Exporter <---------------------> TPA Actions

MAX_POWER

  • Playmaker Newbie
  • *
  • Posts: 40
    • View Profile
Re: Clearing a generic list.
« Reply #2 on: February 12, 2018, 12:35:08 AM »
Hi.
I have added a "Reset" bool where you can place a variable and you can set that bool to true on a different state.
Then when TriggerEventOncePerObject is called again it will check if that bool is true and reset the list + set it back to false.

Can you try if it works as you want?

Sounds absolutely fantastic. Yes I'm willing try to it out. Just let me know where to download the script. Thanks!
« Last Edit: February 12, 2018, 12:37:49 AM by MAX_POWER »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4317
    • View Profile
    • jinxtergames
Re: Clearing a generic list.
« Reply #3 on: February 12, 2018, 02:04:25 AM »
Hi.
Just get it again from the Ecosystem :)
FOR HIRE:Playmaker/C#

Playmaker Samples <-------------> Easy Exporter <---------------------> TPA Actions

MAX_POWER

  • Playmaker Newbie
  • *
  • Posts: 40
    • View Profile
Re: Clearing a generic list.
« Reply #4 on: February 12, 2018, 02:40:14 AM »
Works like a charm now. It's just fantastic to see somebody doing an update so fast.  Thank you so much!

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4317
    • View Profile
    • jinxtergames
Re: Clearing a generic list.
« Reply #5 on: February 12, 2018, 02:52:46 AM »
Hi,
Happy to help :D
FOR HIRE:Playmaker/C#

Playmaker Samples <-------------> Easy Exporter <---------------------> TPA Actions