X
X
Xoggas2020-08-26 12:01:58
C++ / C#
Xoggas, 2020-08-26 12:01:58

How to change marker variable in timeline via code?

I have a timeline with markers, but I need to change the variable I need at a specific marker through the code. Custom markers.

using UnityEngine;
using UnityEngine.Playables;
using UnityEngine.Timeline;

public class RECTANGLESIGNAL : Marker, INotification, INotificationOptionProvider
{
    [SerializeField] private bool retroactive = false;
    [SerializeField] private bool emitOnce = true;

    [Space(20)]
    [SerializeField] private string side = "any";
    [SerializeField] private float speed = 10f;

    public PropertyName id => new PropertyName();
    public string Side => side;
    public float Speed => speed;
    
    public NotificationFlags flags => (retroactive ? NotificationFlags.Retroactive : default) | (emitOnce ? NotificationFlags.TriggerOnce : default);
}

For example, I need to change the speed value through a script, is it possible to do this at all? (despite the fact that the variables are private)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
Gennady Kruglov, 2020-08-26
@robinzonejob

despite the fact that the variables are private

Private fields are private because they can only be accessed within the class.
It's not entirely clear what the difficulty is. You can make a public setter for the Speed ​​property or write a public SetSpeed(float speedValue) method, through which, in the client code, change the value of the speed field.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question