How to serialize unity's timeline.
Posted: Sun Sep 25, 2022 3:15 pm
Hi, I am using a 3rd party asset that enables the easy adding of events to unity's timeline. Timeline Ez Events (TEz)
https://assetstore.unity.com/packages/t ... 84#reviews
and would like to be able to:
1. Serialize the timeline TEz from the editor
2. import the serialized TEz into the game at runtime
3. add new events into the timeline TEz
4. save the changes at runtime.
Update: I am using ES3 autosave and autotype feature:
When I ran the autotyping, Since TEz is built on Unity's timeline package, i got a bunch of errors because some of Unity's timeline classes are not public. I made a copy of unity's timeline and modified the access of various classes to allow Easysave to have access. I managed to resolve most of the errors except two.
protected override object ReadObject<T>(ES3Reader reader)
{
var instance = new UnityEngine.Timeline.TimelineClip();
ReadObject<T>(reader, instance);
return instance;
}
The error is: TimelineClip() cannot be called with zero arguments.
Here is the actual method, it needs a TrackAsset.
public TimelineClip(TrackAsset parent)
{
// parent clip into track
SetParentTrack_Internal(parent);
}
Another error:
protected override object ReadObject<T>(ES3Reader reader)
{
var instance = new Bizzini.TimelineEzEvents.TimelineEzEventsInvocationManagement();
ReadObject<T>(reader, instance);
return instance;
}
Actual method has 4 arguments:
public TimelineEzEventsInvocationManagement(EzEvent evt, TimelineEzEventsHelper.BehaviourMethodData behaviourConditionMethodData, TimelineEzEventsHelper.BehaviourMethodData behaviourDefaultOrTrueMethodData, TimelineEzEventsHelper.BehaviourMethodData behaviourFalseMethodData)
{
linkedEvent = evt;
targetBehaviour_Condition_MethodData = behaviourConditionMethodData;
targetBehaviour_DefaultOrTrue_MethodData = behaviourDefaultOrTrueMethodData;
targetBehaviour_False_MethodData = behaviourFalseMethodData;
cachedInvokeArgs = new object[3][];
}
https://assetstore.unity.com/packages/t ... 84#reviews
and would like to be able to:
1. Serialize the timeline TEz from the editor
2. import the serialized TEz into the game at runtime
3. add new events into the timeline TEz
4. save the changes at runtime.
Update: I am using ES3 autosave and autotype feature:
When I ran the autotyping, Since TEz is built on Unity's timeline package, i got a bunch of errors because some of Unity's timeline classes are not public. I made a copy of unity's timeline and modified the access of various classes to allow Easysave to have access. I managed to resolve most of the errors except two.
protected override object ReadObject<T>(ES3Reader reader)
{
var instance = new UnityEngine.Timeline.TimelineClip();
ReadObject<T>(reader, instance);
return instance;
}
The error is: TimelineClip() cannot be called with zero arguments.
Here is the actual method, it needs a TrackAsset.
public TimelineClip(TrackAsset parent)
{
// parent clip into track
SetParentTrack_Internal(parent);
}
Another error:
protected override object ReadObject<T>(ES3Reader reader)
{
var instance = new Bizzini.TimelineEzEvents.TimelineEzEventsInvocationManagement();
ReadObject<T>(reader, instance);
return instance;
}
Actual method has 4 arguments:
public TimelineEzEventsInvocationManagement(EzEvent evt, TimelineEzEventsHelper.BehaviourMethodData behaviourConditionMethodData, TimelineEzEventsHelper.BehaviourMethodData behaviourDefaultOrTrueMethodData, TimelineEzEventsHelper.BehaviourMethodData behaviourFalseMethodData)
{
linkedEvent = evt;
targetBehaviour_Condition_MethodData = behaviourConditionMethodData;
targetBehaviour_DefaultOrTrue_MethodData = behaviourDefaultOrTrueMethodData;
targetBehaviour_False_MethodData = behaviourFalseMethodData;
cachedInvokeArgs = new object[3][];
}