playMaker

Author Topic: (SOLVED) Set scene object as a child to instantiated prefab?  (Read 1583 times)

Aaddiction

  • Full Member
  • ***
  • Posts: 166
I have object A that I want to set as child to a prefab that I'm spawning at runtime using the set parent action.

However, Unity is not allowing that: "Setting the parent of a transform which resides in a Prefab Asset is disabled to prevent data corruption".

How to achieve the above without set parent action?
« Last Edit: July 07, 2020, 08:15:02 AM by Aaddiction »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Set scene object as a child to instantiated prefab?
« Reply #1 on: July 07, 2020, 02:31:33 AM »
Hi,

 I think it's because you try to alter the actual prefab and not an instance of it.

 Make sure you clone the prefab using instantiate and that you then work with that clone.

Bye,

 Jean

Aaddiction

  • Full Member
  • ***
  • Posts: 166
Re: Set scene object as a child to instantiated prefab?
« Reply #2 on: July 07, 2020, 08:14:40 AM »
This is it! Thank you!