How to reproduce:
1. Create a new Unity project
2. Create and open any UXML (UI Document) in the UI Builder
3. Add a VisualElement to the Hierarchy and select it
4. In the Inspector, under Background, set the Image dropdown to "Gradient"
5. Right-click the Image field and select "Set Variable"
6. Observe the Console
Expected results: No errors are thrown and the variable is set on the Image field
Actual results: "ArgumentOutOfRangeException: Specified argument was out of the range of valid values." error is thrown
Reproducible with: 6000.7.0a4, 6000.7.0b1
Can't test with: 6000.7.0a3 (No Gradient)
Reproducible on: macOS Tahoe 26 (M1)
Not reproducible on: No other environment tested
Note: Once the variable is set this way, it cannot be removed or edited from the field like other variable-bound style fields — it has to be deleted manually.
First lines of error:
ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Unity.UI.Builder.StylePropertyManipulator.GetInternalIndices (System.Int32 index) (at /Users/bokken/build/output/unity/unity/Modules/UIBuilder/Editor/Utilities/StyleSheetExtensions/StylePropertyManipulator.cs:831)
Unity.UI.Builder.StylePropertyManipulator.SetVariableAtIndex (System.Int32 index, System.String variableName) (at /Users/bokken/build/output/unity/unity/Modules/UIBuilder/Editor/Utilities/StyleSheetExtensions/StylePropertyManipulator.cs:412)
Unity.UI.Builder.BuilderInspectorStyleFields.OnFieldVariableChangeImplInBatch (System.String newValue, System.String styleName, System.Int32 index, UnityEngine.UIElements.StyleProperty& property) (at /Users/bokken/build/output/unity/unity/Modules/UIBuilder/Editor/Builder/Inspector/BuilderInspectorStyleFields.cs:1978)