x


My prefabs have all become completely unlinked!

I accidentally moved my Assets folder, then opened Unity (3). I saw my error and quickly closed Unity, moved the Assets folder back, then reopened Unity. However, it imported the whole project again and straight away everything was screwy... My materials were unlinked to my textures, my scripts were unlinked to my objects, and my prefabs were all unlinked to their instances.

I can relink the textures and scripts, but the prefabs are more difficult. There are a ton of instances of one prefab, and in the Hierachy they are all listed in a pinky colour. I cannot seem to relink them to the prefab, so I can't relink their texture using the prefab.

How do I fix this?

more ▼

asked Jan 19 '11 at 05:00 PM

robinking gravatar image

robinking
756 61 68 81

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

I wrote a script to help with this. It won't fix everything, but at least will reposition things where they were. Hope it helps:

http://www.unifycommunity.com/wiki/index.php?title=ReplaceSelection

Select the affected objects (you can multi-select), and use this, then choose the original prefab, then hit replace, it will reinstantiate them in place and correctly parented

more ▼

answered Jan 19 '11 at 05:20 PM

DaveA gravatar image

DaveA
26.5k 151 171 256

OH MY GOD that is unbelievably fantastic! Thank you so much - I was dreading the thought of doing this by hand, and this is exactly what I needed. Not only that, but I've learned something about Editor scripts, AND about backing up (I had only been backing up the Assets folder!) YOU'RE A STAR.

Jan 19 '11 at 05:51 PM robinking

....(blush)....

Jan 19 '11 at 05:58 PM DaveA
(comments are locked)
10|3000 characters needed characters left

This won't help retroactively, but I have an editor script that lets you do a deep inspection of the scene, with an option to dump to a text file. You should of course back up your scene regularly(!), but if you also dump to text each time you back up, you not only have the backup, you can also figure out what's changed (by dumping the scene again and comparing the output).

You can find the script(s) here.

more ▼

answered Jan 20 '11 at 07:45 AM

yoyo gravatar image

yoyo
6.4k 25 39 84

Good stuff thank you

Jan 20 '11 at 07:47 AM Art

p.s. Note that there are some limitations to that script, including an inability to drill into arrays. Not too hard to fix, and I'm open to other suggestions and feature requests.

Jan 20 '11 at 11:57 PM yoyo
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1254
x348
x29
x20
x10

asked: Jan 19 '11 at 05:00 PM

Seen: 1635 times

Last Updated: Jan 19 '11 at 05:00 PM