Sites

Menu

UIStateManager Class

Namespace: Improbable.Gdk.Core.Editor
GDK package: Core
Source

Unity's GUIUtility.GetStateObject changes based on the structure of the GUI, for example when expanding or collapsing foldouts. Even with hints, tracking the state objects goes awry. This is a simpler implementation, meant to be used with object hashes generated by the call site, which at least has insight into what parts of the object will be stable enough to track.


Methods

GetStateObjectOrDefault<T> Source
T GetStateObjectOrDefault<T>(int hash)

Attempts to get the state object associated with the hash, else returns a default constructed copy of the state object.

Returns:
The state object associated with the hash, or a default constructed object of type T.

Parameters
  • int hash : The hash to fetch the state object.

Notes:
  • If no object is associated with hash then a default constructed one is inserted.

Type parameters:
  • T : The type of the state object.
SetStateObject<T> Source
void SetStateObject<T>(int hash, T obj)

Sets the state object for a hash.

Parameters
  • int hash : The hash to associate the state object with.
  • T obj : The object to store with the hash.

Type parameters:
  • T : The type of the state object.

Search results

Was this page helpful?

Thanks for letting us know!

Thanks for your feedback

Need more help? Ask on the forums