/// <summary> /// Read the control's default value and return it as an object. /// </summary> /// <param name="control">Control to read default value from.</param> /// <returns></returns> /// <exception cref="ArgumentNullException"><paramref name="control"/> is null.</exception> /// <remarks> /// This method allocates GC memory and should thus not be used during normal gameplay. /// </remarks> /// <seealso cref="InputControl.hasDefaultState"/> /// <seealso cref="InputControl.defaultStatePtr"/> public static unsafe object ReadDefaultValueAsObject(this InputControl control) { if (control == null) { throw new ArgumentNullException(nameof(control)); } return(control.ReadValueFromStateAsObject(control.defaultStatePtr)); }