Ignition / ScrollBox

Namespace Playniax.Ignition.UI

Inherits from MonoBehaviour

Class or component can be found in Assets/Playniax/Ignition/UI/Scripts (MonoBehaviour)/ScrollBox.cs

Class ScrollBox

Description

The scrollbox supports text, url links and images and it has its own scripting language.

Public MethodsDescription
GameObject Contains(string value)Returns GameObject if it contains value.
void SetPosition(string value)Sets the scrollbox position by value.

See ScrollBox Scripting for a more in-depth explanation.

Example

Example scene can be found in Assets/Playniax/Ignition/Examples/02 - UI/Scrollbox/Scrollbox Tabs.unity

Example script can be found in Assets/Playniax/Ignition/Examples/02 - UI/Scrollbox/Scripts (MonoBehaviour)/SetPosition_Example.cs
using UnityEngine; using UnityEngine.UI; using Playniax.Ignition.UI; public class SetPosition_Example : MonoBehaviour { public string text; public Button button; public ScrollBoxSwipe scrollBoxSwipe; void Awake() { // Below some fancy code to assign the component variables: // Try to find ScrollBoxSwipe component in the scene. if (scrollBoxSwipe == null) scrollBoxSwipe = FindObjectOfType<ScrollBoxSwipe>(); // Try to find the button. if (button == null) button = GetComponent<Button>(); // Add a listener for detecting button click. if (button && scrollBoxSwipe && text != "") button.onClick.AddListener(OnClick); } void OnClick() { // Stop scrolling. scrollBoxSwipe.Stop(); // Set scroll position using the button text as keyword. if (scrollBoxSwipe.scrollBox) scrollBoxSwipe.scrollBox.SetPosition(text); } }