SetKeyOrder(IReadOnlyList<long>)
Reorders the keys to match a given sequence of ids.
Read time 1 minuteLast updated 13 days ago
Definition
- Type: Method
- Namespace: Unity.Localization
- Assembly: UnityEngine.LocalizationRuntimeModule
public void SetKeyOrder(IReadOnlyList<long> orderedIds)
Parameters
The desired key-id order.
Remarks
Keys are arranged in the order their ids appear in . Ids that are not listed keep their relative order and follow the listed keys. A null or empty list leaves the order unchanged.
orderedIdsAdditional Resources: SharedTableData.Entries
Move a key to the front by listing its id first.
Examples
using System.Collections.Generic;using Unity.Localization;using UnityEngine;namespace Unity.Localization.Samples{ public class SharedTableDataSetKeyOrderExample { public void Run() { var sharedData = ScriptableObject.CreateInstance<SharedTableData>(); long a = sharedData.AddKey("A").Id; long b = sharedData.AddKey("B").Id; sharedData.SetKeyOrder(new List<long> { b, a }); // B now comes first Debug.Log(sharedData.Entries[0].Key); // B } }}