Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void CopyValues<T>(T source, T target) where T : ScriptableObject
- {
- if (source == null || target == null || source.GetType() != target.GetType()) return;
- FieldInfo[] fields = source.GetType().GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
- foreach (FieldInfo field in fields)
- {
- object value = field.GetValue(source);
- field.SetValue(target, value);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment