Hey i want to use a string to search for a variable in another script like you can see in the code but unity wont let me do that. Is this even possible it would just save me a bit of work but i wanted to automate as much as possible.
public string ItemName = "Axe";
//Savesystem
GameData data = SaveSystem.LoadPlayer();
Item = data. + ItemName;
you can do it by encapsulation you cannot inherit string and variables
you can do it like this If it helps please give alike means alot
On Script A
public string ReturnGrenade() { return noOfGrenade; //it will return String }
on Script B
[SerializeField] ScriptA scriptA; //intialization of ScriptA
string nade = scriptA.ReturnGrenade(); //Searches and return a variable for Script A