Prefab UI Slider misses the fill and background items...
Hi there,
To change and lerp my healtbar color I want to add this (unity tutorial) line to my UI script:
a_FillImage.color = Color.Lerp (a_ZeroHealthColor, a_FullHealthColor, enemyScript.a_CurrentHealth / enemyScript.a_StartingHealth);
BUT I cannot find the 'fill image' in the prefab (assest folder) in order to drag it on the 'public Image a_FillImage' field in the inspector. As soon I turn my panel, that holds my slider, into a prefab it loses those items (fill & background). See pictures.
assest folder:
hierarcgy:
Is this normal for UI prefabs to lose some children?
And if so, is there a work around? I hope someone can help me!! THNX!
Hi @ngerbens I am facing the same problem. Did you solve it?
Hi @Sponge$$anonymous$$ax, thanks for your reply.
To be quite honest I'm not sure anymore what I was trying to achieve with this question; it was quite a while ago. ;-) So I cannot be sure if I found the solution back then or if I worked around it. But whát I know is that I have a working UI on a prefab object (I just checked).
Anyway, if you could be more specific about your problem, I might dive into my own project and see if I have a solution for you. Cheers.
Thank you for your super quick answer! :) The problem is exactly the same as the one you described in this post! Yesterday I posted this question in a new thread and looks like that it's the correct Unity behaviour. At the end of the day it's not a problem, because when I instantiate the prefab I get every children instantiated too, but for me it's a little bit uncomfortable. Thanks again!
Your answer
Follow this Question
Related Questions
prefab script accesses prefab values instead of instantiated values - but only in the player 0 Answers
i try make enemy health slider or any uI just show the health of Enemy Over head 0 Answers
No Script option in component Menu?! (Unity 5.3.1) 3 Answers
Move UI panel on and off screen, scripted without animation 0 Answers
Certain scripts that are attached does not work after build, scene change and closing unity 0 Answers