error trying to copy PropertyInfo. Non-static method requires a target.

this worked like a charm before? and i don’t see why it doesn’t anymore …

public void PickUp(Item item)
	{
		Item i = new Component() as Item;
		BindingFlags flags = BindingFlags.Public | BindingFlags.Instance;
		foreach (PropertyInfo f in item.GetType().GetProperties(flags))
		{
			Debug.Log(f.PropertyType.Name);
			if(f.PropertyType == typeof(Transform))
				break;
			f.SetValue(i, f.GetValue(item, null), null);
		}
		Inventory.itemList.Add(i);
		Destroy(item.gameObject);
	}

error:

TargetException: Non-static method requires a target.
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:236)
System.Reflection.MonoProperty.SetValue (System.Object obj, System.Object value, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] index, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.Reflection/MonoProperty.cs:348)
System.Reflection.PropertyInfo.SetValue (System.Object obj, System.Object value, System.Object[] index) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.Reflection/PropertyInfo.cs:102)
PlayerCharacter.PickUp (.Item item) (at Assets/Scripts/CharacterScripts/PlayerCharacter.cs:69)
PlayerCharacter.LateUpdate () (at Assets/Scripts/CharacterScripts/PlayerCharacter.cs:57)

Most likely a null reference. I had a problem too with static and non static classes as well. Is the Item class static or any class your using static?

Item i = new Component() as Item;

will always return null, if Component do not extend Item

@DexRobinson: nope no static classes in use.
@PrefabEvolution: i swear i had it working like this before… is there an other way to create an instance of a class inheriting from monobehaviour?

Item i = this.AddComponent(item.GetType()) as Item

but all i want to do is copy the values to a new instance for a list in the inventory. i don’t have a gameobject to put it on.
guess i can’t have a instance of a component without a gameobject in the scene for it to sit on. bummer. back to ScriptableObject then.