dotween
dotween copied to clipboard
Can onStart in Tween be public?
Can onStart in Tween be public? Is there good reason why this is not the case? It would seem consistent this way with other tween callbacks.
Currently line with public field of onStart in tween.cs is commented (and in ABSSequentiable field is not public) :
// public TweenCallback onStart; // (in ABSSequentiable) When the tween is set in a PLAY state the first time, AFTER any eventual delay
While it would be nice to have this it is not absolutely necessary as I've managed to work around this in a bit hacky way:
public static TweenCallback GetOnStart(this Tween tween)
{
return GetInstanceField(typeof(Tween), tween, "onStart") as TweenCallback;
}
internal static object GetInstanceField(Type type, object instance, string fieldName)
{
BindingFlags bindFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic
| BindingFlags.Static;
FieldInfo field = type.GetField(fieldName, bindFlags);
return field.GetValue(instance);
}
+1