- Home /
Question by
Rtsgamerx · Nov 16, 2018 at 03:37 PM ·
unity 5instantiateprefabschildren
How to instantiate several weapons with references to other child of prefabs?
The situation is I have a script attached to each weapon that tells the damage, the range, the reload time ect. for each weapon. It also handles its shooting and animations. The problem is in this script I am referring to second or third tier of prefabs and I want to instantiate these weapons so I have to make them prefabs and I cannot access third tier of other prefabs to drag them in the inspector. So I think a solution is to only store the variables and handling the shooting in another script attached to the player when I can drag the prefabs, but how do I tell which weapon is selected and pass its variable to the script? Or if there is any other solution it is more than welcomed. Thanks in advance for answering.
Comment