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.)
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?
Yes. I have another very similar prefab and it has done the same thing.
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.
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;
}
Your answer
Follow this Question
Related Questions
Error when trying to upload a package to the unity asset store (file not found, loader.html) 2 Answers
Strange Memory Leak in Unity Editor 0 Answers
Unity Editor very slow using graphics processor Nvidia GeForce GTX 1060 1 Answer
Scene view visual glitch, multiplying objects (like WindowsXP bug) 1 Answer
Unity hangs when opening a project. 0 Answers