This question has been asked before but nobody has ever actually answered it. Everyone has just provided work-arounds and alternate solutions.
In my case, I am writing a plugin that needs to replace a gameobject with another. The specific gameobject I am replacing is UNKNOWN to me. And the potential references that may exist in my client's project to this gameobject is UNKNOWN to me.
IT IS THEREFORE IMPOSSIBLE for me to create some cheap hack solution that involves destroying the old game object, and spawning a new one in its place, and then attempting to "update the references" everywhere in their project, since I know nothing about their project, or the references, or even the gameobject.
I need to ACTUALLY REPLACE the gameobject in a way where UNITY will NOT break the references, because UNITY DOES NOT consider the gameobject to have been destroyed. NO CALLS to Destroy(). An actual bona fide replace is needed. This ought to be possible, surely I'm not the first person who has ever needed this.
↧