- Home /
Active Prefabs
I am setting up a system where I click an object to enable another object, then I can click another object to disable both those objects...etc.
My problem is that the objects are prefabs. If I destroy it, I cannot access it to instantiate it again, and I cannot set prefab.active to simply disable it instead of destroying it.
The code is spread across multiple classes so I can't just paste it, but code should not be needed. I simply need to know how to add a reference to the object I want to enable and disable (it is a prefab I drag and drop on the script as a game object) without destroying it to disable it.
Hope that makes sense, I can try explaining another way if needed.
Answer by syclamoth · Dec 01, 2011 at 09:43 PM
You shouldn't be disabling the prefab itself. Try instantiating a 'prototype' object in Awake or something, somewhere far away from where the action occurs (9999,99999,9999 or something), and then using that like you would use a prefab. This way, you don't have to worry about modifying the prefab, and you can make all the changes you like before duplicating it.
Your answer
Follow this Question
Related Questions
how to destroy camera instatiated from prefab? 0 Answers
Destroy and instantiate far objects 2 Answers
Can't remove instantiated prefab 0 Answers
Prefab instantiation and destruction 3 Answers