I should precede my question by saying I am Unity newbie so am trying to learn many things with regards to it, but am unsure with an issue I am getting here and haven’t been able to find a solution. It is using a game / code that had already been written by someone else in a previous version of Unity (not in contact with that person anymore and unsure on exact version). Previously this part of the game was working, but upon opening the project in the version 3.4.2 this aspect of the game does not work correctly now.
To get to the point of the problem, I have a jetfire that when it collides with a wall it creates another particle stream of fire and smoke rising. This still works fine currently, but when you now move the location of the wall instead of the fire and smoke that arose due to collision being destroyed it remains in place.
Originally, the code used the following
Destroy(instantiatedFire);
Destroy( instantiatedSmoke );
This in the new version of Unity gave the error message that it could not destroy a transform. Through searching through other similar questions asked I changed this code to the following:
Destroy( (instantiatedFire as Transform).gameObject );
Destroy ( (instantiatedSmoke as Transform).gameObject );
This instead of just destroying the instantiated fire and smoke when you moved the wall, as it should have done, it destroyed it to the extent that it wasn’t even created even though there is code following it to instantiate the fire. Part of the following code here:
var instantiatedFireOrigin = hit.point + hit.normal*0.75;
instantiatedFire = Instantiate(radialFire, instantiatedFireOrigin, Quaternion.identity);
var rotationAxis : Vector3 = instantiatedFire.transform.TransformDirection(1, 0, 0);
instantiatedFire.transform.rotation = Quaternion.FromToRotation(rotationAxis, hit.normal);
Would be grateful for any feedback on this to hopefully try and sort this issue.