Ignition / ScrollBox
Namespace
Playniax.Ignition.UIInherits from
MonoBehaviourScript can be found in
Assets/Playniax/Framework/Ignition/Scripts (MonoBehaviour)/UI/ScrollBox.cs
Class ScrollBox
DescriptionThe scrollbox supports text, url links and images and it has its own scripting language.
Public Methods | Description |
---|
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 can be found in
Assets/Playniax/Framework/Ignition/Examples/02 - UI/Scrollbox/Scrollbox Tabs.unityExample script can be found in
Assets/Playniax/Framework/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);
}
}