Skip to content

Instantly share code, notes, and snippets.

@shanecelis
Last active Aug 31, 2022
Embed
What would you like to do?
Exposes runtime progress bar for UIToolkit for Unity 2020.3.
/** Using UIElements and want to use UIToolkit's progress bar at runtime? Hope,
you're using Unity 2021.1 or later. If you aren't, you can expose the
progress bar in Unity 2020.3 and perhaps even earlier versions (not tested).
`com.unity.ui v1.0.0-preview.18` uses the following #ifdef for the
`ProgressBar` class[1]:
```
#if !UIE_PACKAGE || UNITY_2021_1_OR_NEWER
```
We use our own #ifdef for 2020.3 or later but exclude it for 2021 and later
so it doesn't conflict with `com.unity.ui`'s actual ProgressBar.
[1]: https://github.com/needle-mirror/com.unity.ui/blob/9837807be0ff6bdf12df2e2bed0cbcef7936e3d9/Core/Controls/ProgressBar.cs
*/
#if !UIE_PACKAGE || UNITY_2020_3_OR_NEWER && ! UNITY_2021_1_OR_NEWER
using UnityEngine.Scripting.APIUpdating;
namespace UnityEngine.UIElements
{
/// <summary>
/// A control that displays the progress between a lower and upper bound value.
/// </summary>
[MovedFrom(true, "UnityEditor.UIElements", "UnityEditor.UIElementsModule")]
public class ProgressBar : AbstractProgressBar
{
/// <undoc/>
public new class UxmlFactory : UxmlFactory<ProgressBar, UxmlTraits> {}
}
}
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment