ObjectReplacer

Author: Xadhoom

Description
Adds a new editor window at menu Custom→Replace Objects. The editor window allows easy replacement of child objects by name by a selected prefab. The editor window expects the object to be dropped in the appropriate object field. A list of transitions can be configured. For each transition its possible to define how the source/replacement transition should be handled. A quick check list on the right side shows which objects will be replaced. The "save"/"load" button manages external transition files which can be saved or loaded here. Finally the Apply button changes replaces the prefab accordingly.

Background information can be found here: http://trianglestrip.blogspot.de/2012/07/object-replacer-editor-script.html

Usage
You must place the script in a folder named Editor in your project's Assets folder for it to work properly.

Click on Custom→Replace Objects

Drop a prefab (not a model file) onto the given object field or select one in the object field.

Define the object names you would like to replace (you can use wildcards) and choose by which prefab it should be replaced. The three buttons on the right of each transition allow to define how to compute the final transition of the replacement. The right most button calculates which child objects will be replaced.

To save the transitions defined press the Save button in the window.

To load transitions from a file press the Load button in the window.

To eventually apply the replacements to the prefab press the Apply button.

Known Issues

 * The script applies each transition one after another from top to bottom. If an objects name would match with several of the transitions the uppermost transition in the list will be applied only.
 * If an object replacement is attached for a matching object it might be matched by following transitions and replaced again.

Solution for both is to use clearly distinguishable object names for your source and target object(s).


 * If a matching object has children they are removed implicitly ignoring them for further processing.