I have quite a complicated spatial setup going on in one of the scenes i'm working on. At the moment I've placed them by hand, but as the number of elements increases and art changes continue occurring its growing frustrating having to do this manually.
I wonder if there is any accepted way of harvesting out certain elements from an imported 3d model and using their position and rotations to create the instances of a given prefab. I guess i'm talking about an editor script which could take the pattern of the names of locators to search the model for, and the prefab to create.
I don't know if actual modelling locators themselves are even imported as they usually don't contain any geometry. At the same time I guess I don't want to waste any time rendering anything that is only present to be a locator for this purpose.
Finally it'd be great if this is at all possible that subsequent imports could have the script update already created instances rather than creating new ones, otherwise the values set for script members on the instances would be lost and i'd have to start again with their setup.
I'm not sure if this matches what you need, but I use Blender as a level editor instead of Unity; what I do would work with any 3D app, however. This has gotten kind of complex, and I'm still working on it. (I don't even know what all I've added since I made the forum posts.) I will be putting a cleaned-up version on the Wiki, with complete documentation, once my next game is out, but feel free to check it out.
Working with Unity, and syncing assets, is kind of a freaking pain if you're not using prefabs, if you need your objects to have scripts applied. (Currently, trying to make a copy of a script and attach it to something else seems to be completely undoable, due to bugs, according to me and a few others who have tried.) But if you are using a lot of prefabs, and/or scriptless objects, I believe this solution will work out well for you.
You mention needing to have unique instance variables. Marking something as a "Clone" in this script can accomplish that. However, that takes away from the power of syncing in ways that I haven't even had time to come up with yet. It might be what you're looking for. Maybe run the complete sync once, then "Clone" all the instances, and set up their scripts as desired. Future syncs will keep these values, but update the transforms as dictated by your 3D app. Also, if you make any mesh edits, that will come through as well.
Personally, I have been just syncing my entire level, then running a Menu Item setup script afterwards that sets up all my unique instance variables. Whether that is appropriate for your use, I don't know.
I'm uploading my latest version right now. http://forum.unity3d.com/viewtopic.php?t=32551
This should be possible with an editor script, but I'm not familiar enough with how exactly Unity imports external models to give you a script. However, you should be able to somehow get a list of locators by giving them a specific name, and searching for objects with that name, or something similar.Then just iterate through the list with a for loop, Instantiate() a new object, and copy the position, rotation and scale of the locator.
answered Jan 05 '10 at 11:40 PM