- Home /
Is there any way to destroy a Transform?
Just a really quick question. Is there any way to destroy a transform? (please answer in JavaScript and C#)
Quick answer, no. (Why would you want to do that?)
Do you mean you want to keep the gameObject, but destroy just the Transform? Then you'd have a gameObject that was nowhere (not even 000)? Like for an empty holding a script?
But, it you have a transform, and want to destroy it and the entire thing it's part of, that's super easy to look up: Destroy(someTranform.gameObject);
Answer by aldonaletto · Oct 31, 2013 at 10:51 PM
According to the Unity Manual, every GameObject has a Transform component. Despite this, the Script Reference about the property GameObject.transform says that it's null when there's no Transform attached (!?!?). Anyway, I'll stay with the Manual: I believe that simple mortals like us won't ever in our lives see a GameObject without a Transform. Based on this (and on what @Graham Dunnett and @Owen Reynolds said), the only way to destroy a Transform is to destroy the whole GameObject.
Your answer
![](https://koobas.hobune.stream/wayback/20220613121030im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
How to import the object from server to unity 2 Answers
Can someone help me fix my Javascript for Flickering Light? 6 Answers
Material doesn't have a color property '_Color' 4 Answers
Setting Scroll View Width GUILayout 1 Answer