Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static Action<SerializedProperty, T> GetDefaultPropertySetter<T>()
- {
- var clrType = typeof (T);
- if (clrType == typeof (string)) {
- return (Action<SerializedProperty, T>) Convert.ChangeType(
- new Action<SerializedProperty, string>(
- (p, s) => p.stringValue = s
- ),
- typeof (Action<SerializedProperty, T>));
- }
- if (clrType == typeof (int)) {
- return (Action<SerializedProperty, T>) Convert.ChangeType(
- new Action<SerializedProperty, int>(
- (p, s) => p.intValue = s
- ),
- typeof (Action<SerializedProperty, T>));
- }
- if (clrType == typeof (float)) {
- return (Action<SerializedProperty, T>) Convert.ChangeType(
- new Action<SerializedProperty, float>(
- (p, s) => p.floatValue = s
- ),
- typeof (Action<SerializedProperty, T>));
- }
- throw new ArgumentException("No default field drawer specified for " + clrType.FullName);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement