How to serialize unity's timeline.

Discussion and help for Easy Save 3
Post Reply
outofspace
Posts: 36
Joined: Wed Jul 03, 2013 7:28 am

How to serialize unity's timeline.

Post by outofspace »

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][];
}
GeneratedES3Types.jpg
GeneratedES3Types.jpg (54.12 KiB) Viewed 580 times
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: How to serialize unity's timeline.

Post by Joel »

Hi there,

Unfortunately as we have no knowledge of the asset you speak of we're unable to provide any direct advice. However, I can give general advice regarding the errors you are getting.

This is because the classes do not have parameterless constructors,which is required to automatically serialise the object (see the Supported Types guide for more information). Instead you would need to provide the required parameters. If you need to load data in order to get the parameters, you can call the load methods at this point. For an example of these please see the ReadObject<T>(ES3Reader reader) method of the ES3Type for Vector3 found in Assets/Plugins/Easy Save 3/Scripts/Types/Unity Types/ES3Type_Vector3.cs.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Post Reply