I have a string list of characters and I’m trying to get information from another exclusive jin.cs or ken.cs file to the main game.cs file.
How to change this
string character_selected;
if (character_selected == "jin")
{
gameObject.GetComponent<jin>().getinfo;
}
if (character_selected == "ken")
{
gameObject.GetComponent<ken>().getinfo;
}
To something like this:
string character_selected;
gameObject.GetComponent<character_selected>().getinfo;
Maybe using .GetType or HingeJoint but it doesn´t work.