- Home /
static weapons?
i have several models that have missile attached to the model , which i fire. and destroy upon impact , this works fine. but i want to be able to re-load these missiles , but there destryod. i have tryed a couple of work arounds but nothing works correctly , is there a way to from the model , when i select a part of the model and drag it to the instpector, into a gameObject , is there a way that it will identify its prefab assoate so that i can generate from the prefab , without manually draging it from the prefab to the script its self
Answer by TurboHermit · Nov 02, 2012 at 12:48 PM
http://docs.unity3d.com/Documentation/ScriptReference/Object.Instantiate.html
Instantiating spawns a chosen prefab at the location, and rotation which you want it to. So when the missile is destroyed you can Instantiate another one at the weapon's location.
the thing is though i would have to link it to the prefab , otherwise it says it cant Instantiat it cause i have deleted it . i wanted an easy way if possible without linking it to the prefab parts
You can use a prefab from your project folder ins$$anonymous$$d of from your hierarchy. This way if you delete the one in your scene/level he'll just copy the initial prefab.
just looked at that , i cant access the prefab part in the inspector cause i have prefab attached to prefab and it only goes 1 deep :(
Your answer