Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by DaveA · Jul 26, 2010 at 06:30 PM · editorprefabmaterialasset

Getting properties on 'missing' things in Editor Scripts?

Often when I move assets (even as Packages) between computers, I have missing scripts, missing materials, missing textures. In the case of scripts, it says 'missing mono script' BUT it lists public variables that those scripts had before it went missing.

I'd like to write an Editor script that will a) find missing components like that, and b) try to match them up with the asset (say, script by comparing public variables), and c) re-attach the assets.

Is any of that possible? I found a script that will detect missing scripts, but how would I get those public variables that it seems to remember?

Is there any way to 'patch up' 'missing' assets?

For example, Prefabs seem to get detached. There is no way to reattach them (that I know of), except to re-add the Prefab, fix it's name if needed, and reset transform etc. as needed. I want to script that.

Help please!

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image SOIL · Sep 08, 2010 at 09:51 AM 0
Share

I have the same problem too. Specially by switching from UNITY PRO to UNITY IPHONE i always lose many linkages! i found a "find missing script" > look at the answer. But i can't help you with the problem on missing textures, materials.

avatar image stijn · Dec 21, 2010 at 11:19 AM 0
Share

I was gonna post the exact same question, ins$$anonymous$$d I'll just bump this. It's quite anoying! What I did notice however, was that links to standard Assets (scripts, textures) are preserved.

4 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by DaveA · Oct 12, 2010 at 12:50 AM

After much searching, coding, and frustration, I've concluded that it is not possible. The best course of action is to use Reflection to save off important settings to a file, then import that file to recreate the objects as needed. Not easy.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image whydoidoit · Nov 14, 2012 at 05:34 PM 0
Share

Dave - I figured this out - it is possible to fix up scripts at least. I read your advice and fiddled and fiddled and came up with a way of doing it. A bodge, but a working one. Package is here.

It works by having an Inspector that will inspect $$anonymous$$onoBehaviours and then an EditorWindow (created by Window>Fix $$anonymous$$issing Scripts) that finds all missing and then rapidly makes them be the focussed object in the inspector - waits for the Inspector to identify if it can fix it (using the rules about an existing script having all of the same fields).

avatar image
0

Answer by SOIL · Sep 08, 2010 at 09:53 AM

Find Missing Script

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image DaveA · Sep 08, 2010 at 06:04 PM 0
Share

Thanks I found this a long time ago (as I said in my question). I need to know which script went missing, or at least the parameter list, so I might be able to deter$$anonymous$$e the script. I've written some export/import scripts to save off stuff before the breakage, so I can repair it after.

avatar image SOIL · Sep 09, 2010 at 05:43 AM 0
Share

oh cool - sounds great! i was not sure u allready found the answer, so i thought i give you that link. but may i suggest you to mark this question as answered or delete it? anyhow - so we can keep this site clean. i do it too. greetings

avatar image Hola Soy Edu Feliz Navidad · Sep 23, 2014 at 01:05 PM 0
Share

Broken link, now it is at: http://wiki.unity3d.com/index.php?title=Find$$anonymous$$issingScripts

avatar image
0

Answer by jwalker · May 08, 2012 at 08:44 PM

I want to try and solve the same problem. Did anyone ever find a way to do this? We often move scripts from being a loose .cs file into a pre-built assembly, or from one pre-built assembly to another. This always breaks the script linkages everywhere and takes a lot of time to manually fix everything. The "Find Missing Scripts" technique helps a bit, but it would be very easy to automatically fix all the scripts, if only there was a way to set the script that the component points to. Currently, the Editor API only provides a way to add new components. I cannot find any way to modify the script that an existing component points to. I know it's possible since the Editor itself allows you to change the script that a component points to, so maybe this is something easy to support in a future version of Unity?

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image JimmyJJeeter · May 12, 2012 at 09:14 AM 0
Share

If you cant change the script, could you remove the old and add a new (assu$$anonymous$$g you knew which one to add)?

avatar image Bunny83 · May 12, 2012 at 03:24 PM 0
Share

@JimmyJJeeter: Unfortunately not. You can't remove this "dead" $$anonymous$$onoBehaviour because the reference is null and you can't deter$$anonymous$$e the old type via scripting.

See $$anonymous$$answer here

avatar image
0

Answer by merlin981 · May 01, 2013 at 03:12 PM

I've posted a utility in the Asset Store which has an Editor script that can fix broken / missing prefabs.

https://www.assetstore.unity3d.com/#/content/8196

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

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

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

before and after apply prefab changes callback 0 Answers

Is it possible to create a Material _asset_ from a script? 3 Answers

Any/best way to add a texture in Editor? 2 Answers

The Script Equivilent of dragging a hierarchy of meshes over a preexisting prefab? 0 Answers

Editor utility for handling nested prefabs.. 4 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges