playMaker

Author Topic: I want to prevent deletion of objects set in array list  (Read 203 times)

kogi180

  • Playmaker Newbie
  • *
  • Posts: 6
    • View Profile
I want to prevent deletion of objects set in array list
« on: April 15, 2019, 07:37:38 AM »
First of all, I apologize for being hard to convey because I use machine translation
It may be a stupid question, but when an object set in array list is deleted from the hierarchy, the same object set in array list will also be deleted
Is it impossible to delete from the hierarchy without deleting it from the array list?

tcmeric

  • Beta Group
  • Hero Member
  • *
  • Posts: 699
    • View Profile
Re: I want to prevent deletion of objects set in array list
« Reply #1 on: April 15, 2019, 08:20:25 AM »
Hello. Your question is clear. The array list has a reference to the hierarchy object. Therefore, if the hierarchy object is deleted, the array list is referencing nothing. An array list does not actually hold an object, but instead only has a reference.

Sometimes, it is better to reference prefabs in your project folder. Then your scene objects will not affect your array list (since you cannot delete a prefab during game play).

kogi180

  • Playmaker Newbie
  • *
  • Posts: 6
    • View Profile
Re: I want to prevent deletion of objects set in array list
« Reply #2 on: April 15, 2019, 11:05:02 AM »
thank you for answering
I hoped that it could be possible but hopefully this solved it
Thanks also for the advice

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4317
    • View Profile
    • jinxtergames
Re: I want to prevent deletion of objects set in array list
« Reply #3 on: April 15, 2019, 12:10:17 PM »
Hi.
If you need the same object to come back regularly you might want to disable instead of removing the object.
This way it will also keep the reference in the array.

But it depends on you project.
FOR HIRE:Playmaker/C#

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

kogi180

  • Playmaker Newbie
  • *
  • Posts: 6
    • View Profile
Re: I want to prevent deletion of objects set in array list
« Reply #4 on: April 16, 2019, 12:13:49 PM »
I am not yet familiar with the playmaker or the program so I can not easily answer the question which is the best for the challenge now
But I want to try variously based on the advice I got
Thank you