I am trying to write this script that allows me to toggle a transform change on/off on a sphere. I think the logic is right but I really can't figure out what I'm missing here. (I am also getting (line 7)error CS0108: 'Scale.transform' hides inherited member 'Component.transform'. Use the new keyword if hiding was intended.)
By the way I'm a total beginner, this might be very simple but this is my first game ever!
Here's the code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Scale : MonoBehaviour
{
    public Transform transform;
    Vector3 scale;
    public float objectSize = 3.0f;
    void ScaleOnOff()
    {
        transform = GetComponent<Transform>();
        if (Input.GetKeyDown(KeyCode.S))
        {
            if (scale.x != objectSize)
            {
                scale = transform.localScale;
                scale.x = objectSize;
                transform.localScale = scale;
                Debug.Log("condition1");
            }
            if (scale.x == objectSize)
            {
                scale = transform.localScale;
                scale.x = 1;
                transform.localScale = scale;
                Debug.Log("condition2");
            }
        }
    }
    // Update is called once per frame
    void Update()
    {
            ScaleOnOff();
    }
}
Also, in the console both of the Debug.Log messages appear, so I'm wondering how can both conditions be true at the same time?
Thanks for your help!
 
     
    