Skip to content

TypeRegistry

Gravinium.Jilwer.Core.TypeRegistry

Runtime methods for interacting with the type registry system.

Example

csharp
var err = TypeRegistry.Create(runtime, nameof(CustomType), out GameObject obj);
if (err != Error.None) {
    value = null;
    return err;
};
var customType = obj.GetComponent<CustomType>();

Declaration

csharp
[UdonBehaviourSyncMode(BehaviourSyncMode.None)]
public class TypeRegistry : UdonSharpBehaviour

Methods

Create

csharp
public static Error Create(JilwerRuntime runtime, string key, out GameObject newObj)
ParameterDescription
runtimeGlobal Jilwer runtime.
keyName of the class being constructed.
newObj (out)Returned GameObject with the requested class.

The Create method will instantiate a new GameObject with the requested key. GetComponent can then be called on the returned object giving the desired type.

Create can fail, returning an Error to be checked before using the returned GameObject.

ErrorCodeDescription
None0x00No error exists.
RuntimeDoesNotExist0x03The runtime passed in was null.
KeyValueNotFound0x04The key could not resolve to a valid GameObject.