playMaker

Author Topic: Activate/Disable Game Component [SOLVED]  (Read 5028 times)

Farwest

  • Beta Group
  • Junior Playmaker
  • *
  • Posts: 63
Activate/Disable Game Component [SOLVED]
« on: February 10, 2018, 09:37:17 AM »
Hi,
We have Add Component and Destroy Component actions, however we don't have Activate and Disable Component actions.

Details, Where and Why I need to use:
I have a main map and cubes with battle-scenes attached (with trigger). Player moves to battle scenes, fight battles and after it returns to main map again. I use a Persistent Save script that keeps Player transform position before going to a battle-scene. After player finishes that scene and returns to main map scene, cube stays at same place with a trigger. So Player returns to same spot on trigger, which creates loop to re-enter to battle scene. To prevent this, I use 2 triggers (outer and inner), which outer one will disable Persistent Save script and inner one Loads the scene. So when Player returns to Main Map, it spawns on the point which Persistent Save script was disabled at that position.

Currently, I tested this with "Destroy Component" and it works as intended. However, after Player is spawned, it doesn't have the component, so I am unable to save the transform position of the Player anymore. Therefore I need a Activate/Disable Game Component action to solve this issue.

Also "Add Component" action brings the Component with default state, but I need that "Persistent Save script" component with its modified state on inspector, therefore if a future Activate/Disable Component action keeps the component state, that would be wonderful.

Thanks!
« Last Edit: February 19, 2018, 08:01:35 PM by Farwest »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Activate/Disable Game Component
« Reply #1 on: February 10, 2018, 07:38:04 PM »
Hi.
You can find a 'Activate Component' (and many more) action on the Ecosystem

Farwest

  • Beta Group
  • Junior Playmaker
  • *
  • Posts: 63
Re: Activate/Disable Game Component
« Reply #2 on: February 17, 2018, 03:19:43 PM »
Thanks, however that isn't the solution I am looking for, because Activate Component action in Ecosystem (and others) don't provide same component slots. Kindly if you can check the image you will understand better:



For example in "Destroy Component" action, we choose Game Object and we are able to select the component attached on it. However the action "Activate Component" in Ecosystem don't have similar slots or feature. This is what I request as Action.

If there is a simple way to reach to a specific attached component in "Activate Component" like we do in "Destroy Component", I will appreciate if you can help me. Thanks.
« Last Edit: February 17, 2018, 03:23:04 PM by Farwest »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Activate/Disable Game Component
« Reply #3 on: February 19, 2018, 02:39:43 AM »
Hi,

 ok, good point, made a new action for this, called ActivateComponent2 on the Ecosystem.

 Let me know if it works for you.

 Bye,

 Jean

Farwest

  • Beta Group
  • Junior Playmaker
  • *
  • Posts: 63
Re: Activate/Disable Game Component
« Reply #4 on: February 19, 2018, 08:00:34 PM »
Hi,

 ok, good point, made a new action for this, called ActivateComponent2 on the Ecosystem.

 Let me know if it works for you.

 Bye,

 Jean

Hi Jean,

It works, thanks!

Broken Stylus

  • Beta Group
  • Hero Member
  • *
  • Posts: 772
Re: Activate/Disable Game Component [SOLVED]
« Reply #5 on: February 28, 2019, 12:15:04 PM »
Hi,

There seems to be a mess in component-related actions.
The Activate component action speaks of destroying a component despite its content doing nothing of the sort.
The Destroy component does not provide a script/behavior component field to drop a component into.
As for the ActivateComponet2 script downloaded from ecosystem, it is again working just as Activate component, so there's no change I can see.

Some updates to the first two actions appear quite necessary.

Typing the name of a component for a FSM is just not working.
I tried Play Maker FSM (Script), I tried the name of the FSM (FSM by default), and then also drag'n'dropped the FSM into the action tab to see what would be indicated as the full name of the component "understood" by Unity, ergo [name of the GO] (PlayMakerFSM), but none of them work.
So that string field is just a pain in the -

Shouldn't there be an action that look at the components on a GO and provide a list to pick from?

I tried to create my own destroy component script with non public game object component vars and tried to get something work with Owner but I can't get the script working and I'm done trying. Takes me too long.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Activate/Disable Game Component [SOLVED]
« Reply #6 on: April 02, 2019, 09:12:13 AM »
Hi,

 You can list all components on a GameObject, the feature is available on action such as EnableBehaviour.

 I just made the DestroyBehaviour, it's on the Ecosystem, I think this is what you need.

 The other actions you mentioned are fine, they just provide a different interface that has its purpose and usage in various design patterns, so let's not touch them.

 Bye,

 Jean