Problem in my script

Hi i’m new in unity3d and i dont now so mutch in programing so I need to now how can i fix my script and thanks for the help :slight_smile: The script : using UnityEngine; using System.Collections; public class HealthGUI : MonoBehaviour { public float scale = 0f; public RectTransform rectTransform; // Use this for initialization public void Update () { rectTransform.localScale = new Vector3{ rectTransform.localScale.x, scale, rectTransform.localScale.x }; } // Update is called once per frame public void AdjlaxScale(float adj ) { if (adj < 0) adj = 0; else if (adj > 1) adj = 1; scale = adj; } }

Hello,
Please replace {} with ().

rectTransform.localScale = new Vector3(rectTransform.localScale.x, scale, rectTransform.localScale.x);

Thank
Ram

Your code seems fine. The only problem there could be is the rectTransform is null.

Have you assigned any object for that ?

Also comment what is the issue. Error / Warning / What happens