So I have a script which I can assign one asset to in the Unity inspector. This bit works fine.
However I wish to assign multiple instantiated prefabs to the script at runtime however there is only 1 slot to add an asset it.
Essentially if look at this image only 1 object is assigned to the script.
Is there anyway that I can assign multiple instantiated objects to the script at runtime?
I’m new to unity and would appreciate any help. Thank you!
CodePudding user response:
Yes, if you use an Array then you can add as many prefabs as you want. You will still need to set the code in the script to handle multiple prefabs.
Although, it sounds like you might not understand the basics for C# and Unity and you might like to take a class, read a tutorial or watch a Youtube video.