Skip to content

Added setter to change fps of an open sequence during runtime#4

Open
TomTfh wants to merge 1 commit intoBuildingVolumes:mainfrom
TomTfh:main
Open

Added setter to change fps of an open sequence during runtime#4
TomTfh wants to merge 1 commit intoBuildingVolumes:mainfrom
TomTfh:main

Conversation

@TomTfh
Copy link
Copy Markdown
Contributor

@TomTfh TomTfh commented Mar 11, 2026

I added a basic Setter do manipulate the framerate of an open sequence.

The important bits are the GeometrySequenceStream (lines 217-221) and in the GeometrySequencePlayer (lines 263-267).

My apologies for the mess, in my workflow i often use Visual Studios feature (cmd+k - cmd + d) to autoformat. I guess i ran this command on those scripts as well...

Best regards :)

PS: For testing i used a very basic class:

using BuildingVolumes.Player;
using UnityEngine;
using UnityEngine.InputSystem;

public class TestFrameRateSetter : MonoBehaviour
{
    [SerializeField]
    float SpeedChange;

    [SerializeField]
    float currentSpeed;
    float baseFPS = 30;

    GeometrySequencePlayer player;

    void Start()
    {
        player = GameObject.Find("GSP")?.GetComponent<GeometrySequencePlayer>();

        if (player == null)
        {
            Debug.Log("Gameobject 'GSP' not found"); return;
        }

        currentSpeed = 1; // get FPSS from player is not working for some reason..
        Debug.Log("initial fps: " + 30 * currentSpeed);
    }

    // Update is called once per frame
    void Update()
    {
        if (Keyboard.current.upArrowKey.wasPressedThisFrame)
        {
            currentSpeed += SpeedChange;
            player.SetFrameRate(baseFPS * currentSpeed);

            Debug.Log("new Framerate: " + baseFPS * currentSpeed);
        }
        if (Keyboard.current.downArrowKey.wasPressedThisFrame)
        {
            currentSpeed -= SpeedChange;
            player.SetFrameRate(baseFPS * currentSpeed);
            Debug.Log("new Framerate: " + baseFPS * currentSpeed);

        }
    }

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant