CyanPlayerObjectPool icon indicating copy to clipboard operation
CyanPlayerObjectPool copied to clipboard

Automate pool size using VRCWorld

Open Happyrobot33 opened this issue 2 years ago • 0 comments

Its possible to automate the pool size assignment by pulling the world size directly from the VRC Api

A function like this can get the current scenes VRCWorld into a variable

private static async Task GetWorld()
        {
            //get the pipeline manager by finding the PipelineManager component in the current scene
            PipelineManager pipelineManager = GameObject.FindObjectOfType<PipelineManager>();
            var worldId = pipelineManager.blueprintId;

            //if its a new world (no id), skip
            if (worldId != null)
            {
                //get the world from the api
                world = await VRCApi.GetWorld(worldId, true);
            }
        }

And then you can query the max capacity by doing world.Capacity

Happyrobot33 avatar Oct 09 '23 14:10 Happyrobot33