Unity关于反射(根据属性名,修改类里的属性)

public static class SetClassValue
{
    ///


    /// 反射传参
    ///

    ///
    ///
    public static void SetValue(string FileName, string content)
    {
        Type type = Type.GetType("Configs");
        object v = Convert.ChangeType(content, type.GetProperty(FileName).PropertyType);
        type.GetProperty(FileName).SetValue(v, content);
    }
}

你可能感兴趣的:(unity功能)