How to get the value of the String Variable from another script?
I'm tying to display the map name on the Text UI controller I have. I programmed it to display the name when I click the button.
I have LevelDetails that stores the name of the level and I made it public to I can modify to the other game objects as well:
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 
 public class objDetails : MonoBehaviour {
     public string displayName;
 }
 
 
               And I have uiIDCatcher script that has the operation to display the name to the Text UI component:
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.EventSystems;
 using UnityEngine.UI;
 
 public class uiIDCatcher : MonoBehaviour {
 
     //Script Referrence
     private objDetails details;
 
     //info section
     public string MapName;
 
     //UIElements
     public Text dispMapName;
 
     //IDs
     public string mapID;
     public string shipID;
     
 
     private void Awake()
     {
         //script components
         details = GetComponent<objDetails>();
 
         //Initialize empty IDs upon awake
         mapID = string.Empty;
         shipID = string.Empty;
     }
 
 
 
     /*
         When a map is clicked, return the value to the catcher
     */
     public void onMapClick()
     {
         mapID = string.Empty;
 
         //Get map ID based  on GameObject name
         mapID = EventSystem.current.currentSelectedGameObject.name;
         MapName = details.displayName;
 
         dispMapName.text = MapName;
 
         //print(mapID);
     }
 
               When I try to press the button, it returns this error and does not do the operation:

What am I doing wrong? I am using C# as my primary scripting language.
Your answer
 
             Follow this Question
Related Questions
Error upon rebooting Unity - "Associated script cannot be loaded" How can I resolve this? 2 Answers
Unity UI Text enable and disable by a C# Script? 2 Answers
UI Text not displaying public int but will display private int 1 Answer
Can anyone point me to a good tutorial for Gear VR media touch controls? 0 Answers
What is the code I would use to make a UI button start an animation? 1 Answer