using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class example : MonoBehaviour
{
    public TheClass theClassObj;
    public class TheClass
    {
        public string valueToDetect;
        public TheClass(string _value)
        {
            valueToDetect = _value;
        }
    }
    public TheClass TheObject1 = new TheClass("123");
    public TheClass TheObject2 = new TheClass("321");
    void Start()
    {
        //[code that finds the class
        //example: by entering value "123" it will find TheObject1 and assign it to theClassObj]
    }
}