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
0
Question by Carstairs · Oct 22, 2012 at 07:04 AM · editor

Script for locating missing files?

Is there a script for finding missing files within prefabs?

I took several prefabs from another project (the angrybots demo) and put them into another project that I'm working with. The prefabs couldn't find their missing scripts or other elements even though I had them in the same place as they were in the demo project.

I'm just wondering if there is a script to automate the process of finding them all.

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 Phoskryfes · Oct 22, 2012 at 09:41 AM 0
Share

Do those prefabs have names and are they in the assests folder?

avatar image Carstairs · Oct 22, 2012 at 11:47 PM 0
Share

All the core files are there, but it just doesn't re-link to them. I'm having to re-link them all with the respective game objects.

1 Reply

· Add your reply
  • Sort: 
avatar image
2

Answer by Hannibalov · Oct 22, 2012 at 08:59 AM

I'm using this script:

 using UnityEngine;
 using UnityEditor;
 
 public class FindMissingScripts : EditorWindow {
 
     [MenuItem("Window/FindMissingScripts")]
     public static void ShowWindow()
     {
         EditorWindow.GetWindow(typeof(FindMissingScripts));
     }
 
     public void OnGUI()
     {
         if (GUILayout.Button("Find Missing Scripts in selected prefabs"))
         {
             FindInSelected();
         }
     }
     private static void FindInSelected()
     {
         GameObject[] go = Selection.gameObjects;
         int go_count = 0, components_count = 0, missing_count = 0;
         foreach (GameObject g in go)
         {
             go_count++;
             Component[] components = g.GetComponents<Component>();
             for (int i = 0; i < components.Length; i++)
             {
                 components_count++;
                 if (components[i] == null)
                 {
                     missing_count++;
                     Debug.Log(g.name + " has an empty script attached in position: " + i);
                 }
             }
         }
 
         Debug.Log(string.Format("Searched {0} GameObjects, {1} components, found {2} missing", go_count, components_count, missing_count));
     }
 }


I hope this is what you are looking for. I won't take the credit, since I found it some time ago, but I can't remember where

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 Carstairs · Oct 22, 2012 at 11:46 PM 0
Share

Thanks for the script. I actually found this on the unity wiki I think it was or something like that. If re-linked some of the scripts but not all of them. Thank, though.

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

11 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Finding and changing the import settings on specific textures. 1 Answer

Preview child particle system in Editor 1 Answer

WebCamTexture performance issue. 1 Answer

Inverted Normals in Player, correct in Editor? 1 Answer

How do I show a model to represent a gameObject in the editor view? 2 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