How to make script communication work in Unity

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Circle : MonoBehaviour
{
[SerializeField]
private float _radius = 0f;
// Start is called before the first frame update
void Start()
{
Debug.Log($"Circumference of {_radius}: " + GetCircumference());
Debug.Log($"Diameter of {_radius}: " + GetDiameter());
}
// Update is called once per frame
void Update()
{

}
float GetCircumference()
{
return 2 * 3.14f * _radius;
}
float GetDiameter()
{
return _radius * 2;
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Display : MonoBehaviour
{
[SerializeField]
private Text _radiusText;
[SerializeField]
private Text _circumferenceText;
[SerializeField]
private Text _diameterText;
// Start is called before the first frame update
void Start()
{
//Display circle details in text UI
}
// Update is called once per frame
void Update()
{

}
}
void Start()
{
//Display circle details in text UI
Circle circle = GetComponent<Circle>();
if (circle != null)
{
_radiusText.text = "Radius: " + _radius ;
_circumferenceText.text = "Circumference: " + circle.GetCircumference();
_diameterText.text = "Diameter: " + circle.GetDiameter();
}
}

public class Circle : MonoBehaviour
{
/* REDACTED */
public float GetCircumference()
{
return 2 * 3.14f * _radius;
}
public float GetDiameter()
{
return _radius * 2;
}
public float GetRadius()
{
return _radius;
}
}
void Start()
{
//Display circle details in text UI
Circle circle = GetComponent<Circle>();
if (circle != null)
{
_radiusText.text = "Radius: " + circle.GetRadius() ;
_circumferenceText.text = "Circumference: " + circle.GetCircumference();
_diameterText.text = "Diameter: " + circle.GetDiameter();
}
}

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store