GCHandle instance_handle = GCHandle.Alloc (instance); IntPtr plugin_wrapper = create_scriptable_object_wrapper (); Type t = instance.GetType(); foreach (PropertyInfo pi in type.GetProperties ()) { if (pi.GetCustomAttributes (typeof (ScriptableAttribute), false).Length == 0) continue; TypeCode tc = Type.GetTypeCode (pi.PropertyType); scriptable_object_add_property (plugin_wrapper, pi.Name, tc, pi.CanRead, pi.CanWrite); }