playMaker

Author Topic: Object Game component Activation/Deactivation  (Read 1595 times)

DanyCHF

  • Playmaker Newbie
  • *
  • Posts: 3
Object Game component Activation/Deactivation
« on: November 09, 2023, 02:02:07 PM »
Hello, I'm fairly new to creating stuff in Unity3d, Im not sure if I do it properly. I have created for my game layout (2D for UI) gridlayout for 100 slots. It gets created, now I need them to stay in their global position, because after I click on any of the fields (its reward pick system) the object gets destroyed. The gridlayout then removes it from the childs. The problem is, I need them to stay in it's position which was added by GridLayout, but once they get destroyed, it just moves all along. It should do it I know. So I tried to activate object component and deactivate it afterwards. It just always stays on deactivated, doesn't matter in which part of the ScriptFlow I put it in, I tried to use bool on it, with setbool on StartState and then flip them once it goes further but it doesnt seem to work either. Any help? I tried the behaviour EnableBahviour action, Add Component and Destroy Component with combination of HasComponent switch and even downloaded the "Activate Component2" from the Ecosystem. Nothing seems to work. If you could help me somehow that would be really great. Other than that, Playmaker is absolute beast!!! I'm so happy I found this visual scripting solution. Thank you
« Last Edit: November 09, 2023, 04:14:12 PM by DanyCHF »

DanyCHF

  • Playmaker Newbie
  • *
  • Posts: 3
Re: Object Game component Activation/Deactivation
« Reply #1 on: November 09, 2023, 04:16:57 PM »
I have accidentaly found another workaround, this stated above didnt work for me but I will just let the fields disappear and disable the UI click function so the grid order doesnt move and stays like it is. Btw, if you still are willing to find me a solution for the problem I have mentioned, I will happily welcome that. Cheers!

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: Object Game component Activation/Deactivation
« Reply #2 on: November 10, 2023, 04:19:16 PM »
Hi.
Yes its a normal behavior for a grid layout.

Best way would be using Alpha to set invisible and the also set interactable false.

Also try to avoid using destroy as it leaves 'garbage' and is cpu heavy