Skip to content
This repository was archived by the owner on Nov 25, 2025. It is now read-only.

Commit 6f482dd

Browse files
BindField<T> methods added to handle BaseField<T> binding in Unity 6 (#1)
Replacing BindIntegerField
1 parent ef15854 commit 6f482dd

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Bindings/Packages/com.virtualmaker.bindings/Runtime/Bindings.UIElements.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -297,21 +297,21 @@ private void BindTextField(TextField textField, Property<string> property, bool
297297
}
298298

299299
#if UNITY_2022_1_OR_NEWER
300-
public void BindIntegerField(string name, Property<int> prop, bool twoWay)
300+
public void BindField<T>(string name, Property<T> property, bool twoWay)
301301
{
302-
if (TryGetElement<IntegerField>(name, out var element))
302+
if (TryGetElement<BaseField<T>>(name, out var element))
303303
{
304-
BindIntegerField(element, prop, twoWay);
304+
BindField<T>(element, property, twoWay);
305305
}
306306
}
307307

308-
private void BindIntegerField(IntegerField intField, Property<int> property, bool twoWay)
308+
public void BindField<T>(BaseField<T> baseField, Property<T> property, bool twoWay)
309309
{
310-
Bind(property, value => intField.value = value);
310+
Bind(property, value => baseField.value = value);
311311

312312
if (twoWay)
313313
{
314-
On<ChangeEvent<int>>(intField, e => property.Value = e.newValue);
314+
On<ChangeEvent<T>>(baseField, e => property.Value = e.newValue);
315315
}
316316
}
317317
#endif

0 commit comments

Comments
 (0)