I am new to Unity and am using a code developed by someone else initially made over two years ago. He had the code destroying a transform component, which previously worked, but now the version 3.4.2 I am using does not allow this transform to be destroyed. Has this changed in a later version?
Further to this I have one gameobject (a fire event) which has many transforms created from it. As I change the position of a wall it collides with I want to destroy the old transform (or clone) and recreate a new one with the correct conditions. Can I destroy this clone / transform in the script as can be done in the inspector by a right click and delete? Or can I hide it in the background or even adapt the transform to the new conditions?
Thanks for your reply. Has this changed with deleting a transform by itself and not having to delete the game object? I ask that as this code worked previously. I will check out those links.
– PeeGI am not a old unity user, so I didn't know if it works before. You can use Destroy to remove GameObject components. But I think that they remove to force every GameObject have always a transformation. http://docs.unity3d.com/Documentation/ScriptReference/Object.Destroy.html?from=GameObject
– SissoCheers. I have tried the Destroy(trans.gameObject) which destroys all transforms and the game object which then won't allow me to instantiate any future transforms I need. So I just need to destroy or change the transform by itself, but leave the game object with the code in its current form.
– PeeGYou cannot destroy the transform component of a game object.
– ShrandisAll sorted. Your answer helped me identify the issues. Some of what had been identified as transforms should have been game objects. This then required destroying a clone as well. Thanks for your help.
– PeeG