Scene reference struct. Can be used to reference a scene by index or by path. More...
Inherits INetworkStruct, and IEquatable< SceneRef >.
Public Member Functions | |
override bool | Equals (object obj) |
Determines whether the specified object is equal to the current SceneRef. More... | |
bool | Equals (SceneRef other) |
Determines whether the specified SceneRef is equal to the current SceneRef. More... | |
override int | GetHashCode () |
Serves as the default hash function. More... | |
bool | IsPath (string path) |
Checks if the SceneRef corresponds to a specific path. More... | |
override string | ToString () |
Returns a string that represents the current SceneRef. More... | |
string | ToString (bool brackets, bool prefix) |
Returns a string that represents the current SceneRef, with optional formatting. More... | |
Static Public Member Functions | |
static SceneRef | FromIndex (int index) |
Creates a SceneRef from an index. More... | |
static SceneRef | FromPath (string path) |
Creates a scene ref from a path. The most common use case for this method is when using Unity's addressable scenes. The path is hashed (31 bit), so on rare occasion there may be a hash collision. In such case consider renaming a scene or construct your own hash and use FromRaw. To check if a scene ref is was created for a specific path, use IsPath. More... | |
static SceneRef | FromRaw (uint rawValue) |
Creates a SceneRef from a raw value. More... | |
static bool | operator!= (SceneRef a, SceneRef b) |
Returns true if the values are not equal. More... | |
static bool | operator== (SceneRef a, SceneRef b) |
Returns true if the values are equal. More... | |
static SceneRef | Parse (string str) |
Parses a SceneRef from a string. More... | |
Public Attributes | |
uint | RawValue |
The raw value of the SceneRef. This can represent either an index or a path hash, depending on the flag. More... | |
Static Public Attributes | |
const uint | FLAG_ADDRESSABLE = 1u << 31 |
A constant representing the flag for addressable scenes. More... | |
const int | SIZE = 4 |
The size of the SceneRef structure in bytes. More... | |
Properties | |
int | AsIndex [get] |
Returns lower 32 bits as an index. More... | |
uint | AsPathHash [get] |
Gets the path hash of the SceneRef. More... | |
bool | IsIndex [get] |
Returns true if this scene ref is an index. More... | |
bool | IsValid [get] |
If this scene index is valid More... | |
static SceneRef | None [get] |
None scene More... | |
Scene reference struct. Can be used to reference a scene by index or by path.
override bool Equals | ( | object | obj | ) |
bool Equals | ( | SceneRef | other | ) |
|
static |
|
static |
Creates a scene ref from a path. The most common use case for this method is when using Unity's addressable scenes. The path is hashed (31 bit), so on rare occasion there may be a hash collision. In such case consider renaming a scene or construct your own hash and use FromRaw. To check if a scene ref is was created for a specific path, use IsPath.
path | The path to create the SceneRef from. |
|
static |
override int GetHashCode | ( | ) |
Serves as the default hash function.
bool IsPath | ( | string | path | ) |
override string ToString | ( | ) |
string ToString | ( | bool | brackets, |
bool | prefix | ||
) |
Returns a string that represents the current SceneRef, with optional formatting.
brackets | If true, the string will be enclosed in brackets. |
prefix | If true, the string will be prefixed with "Scene:". |
|
static |
A constant representing the flag for addressable scenes.
uint RawValue |
The raw value of the SceneRef. This can represent either an index or a path hash, depending on the flag.
|
static |
The size of the SceneRef structure in bytes.
|
get |
Returns lower 32 bits as an index.
|
get |
|
get |
Returns true if this scene ref is an index.
|
get |
If this scene index is valid
|
staticget |
None scene