• 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 /
  • Help Room /
avatar image
0
Question by $$anonymous$$ · Sep 15, 2015 at 06:55 PM · editorbugnullreferenceexceptionbug-perhapsmissing script

UnityEngine.UI.Image keeps removing itself from a Prefab.

I have a really weird problem and it seems to happen randomly (or whenever I close + open Unity.) I am running Unity 5.0.2f1 and it seems to do it when I close off of unity.... I am saving the prefab and the scene so there shouldn't be a problem. When I do get the problem, my other main scripts relay on that image script being there so when it disappears, nothing works.

What it seems to do it sort of remove it self so I get "Missing Script" errors. Any suggestions? (I am updating Unity but where I live, the internet is fairly slow (0.1mbps up / 1mbps down) so I don't really want to update.)

Comment
Add comment · Show 4
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 kjakubison · Sep 15, 2015 at 07:01 PM 0
Share

I've seen this happen on Animations and such that are imported. Have you tried to recreate or duplicate your asset to see if this changes anything?

avatar image $$anonymous$$ kjakubison · Sep 15, 2015 at 07:21 PM 0
Share

Yes. I have another very similar prefab and it has done the same thing.

avatar image kjakubison $$anonymous$$ · Sep 15, 2015 at 07:32 PM 0
Share

Did you copy those GameObjects over from another Project that you were using or were they freshly created in your current project? I have noticed some issues with copying objects over from different projects as well.

Show more comments

1 Reply

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

Answer by $$anonymous$$ · Sep 15, 2015 at 08:01 PM

@kjakubison It's okay for I have thought of a slightly hacky solution!

 public Sprite mySprite; //Or something like that...
 
 void Awake()
 {
     gameObject.AddComponent<UnityEngine.UI.Image>();
     gameObject.GetComponent<UnityEngine.UI.Image>().sprite = mySprite;
 
     //Just for my purposes
     gameObject.GetComponent<UnityEngine.UI.Image>().enabled = false;
 }
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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

28 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Strange Memory Leak in Unity Editor 0 Answers

Error when trying to upload a package to the unity asset store (file not found, loader.html) 2 Answers

Unity 5.0 Crashing At Opening A Project 6 Answers

Working with UI makes both editor and game view jump between 1x and 2x scale. 1 Answer

unity seems to be broken for me? 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges