- Home /
Question by
coridoody · Oct 29, 2020 at 06:14 AM ·
scalingstartrender order
when I run this code in the start function the HealthBar object stops being rendered it still exists but it's not showing,My HealthBar object is disappearing when I run this code in the Start() function
Transform healthBar = HealthBar.GetComponent<Transform>();
healthBar.localScale = new Vector3(maxHealth, 0, 0);
currentHealth = maxHealth;
,
Transform healthBar = HealthBar.GetComponent(); healthBar.localScale = new Vector3(maxHealth, 0, 0); currentHealth = maxHealth;
Comment
Answer by rh_galaxy · Oct 29, 2020 at 06:20 AM
Try setting 1 as scale for Y and Z, 0 will make it not visible.
healthBar.localScale = new Vector3(maxHealth, 1, 1);
Answer by CyberGamer1907 · Oct 29, 2020 at 09:51 AM
Change zero values in Vector3. Give higher values for Y and Z. 0 make it dissapear.
Your answer
![](https://koobas.hobune.stream/wayback/20220613014756im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Initialising List array for use in a custom Editor 1 Answer
How To Make A Pause Menu? 1 Answer
Settings, Game icon, Start Unity scene... 1 Answer
A question about instantiating. 1 Answer
How to start in Unity? 1 Answer