Open fawad0dev opened 7 months ago
using NaughtyAttributes;
using Timeline.Samples;
using UnityEngine;
using UnityEngine.Playables;
using UnityEngine.Timeline;
public class CustomDialogPlayableAsset : PlayableAsset, ITimelineClipAsset
{
[NoFoldOut]
[NotKeyable]
public CustomDialogBehaviour template = new()
{
cloudColor = Color.white,
textColor = Color.white,
dialogText = ""
};
[Button("ToUpper")] // this also not displaying any btn
void ToUpper()
{
UnityEditor.Undo.RecordObject(this, "ToUpperCase");
template.dialogText = template.dialogText.ToUpper();
UnityEditor.EditorUtility.SetDirty(this);
}
public ClipCaps clipCaps
{
get { return ClipCaps.Blending; }
}
public override Playable CreatePlayable(PlayableGraph graph, GameObject owner)
{
return ScriptPlayable<CustomDialogBehaviour>.Create(graph, template);
}
}
#if UNITY_EDITOR
[UnityEditor.CustomEditor(typeof(CustomDialogPlayableAsset)), UnityEditor.CanEditMultipleObjects]
public class CustomDialogPlayableAssetEditor : UnityEditor.Editor
{
public override void OnInspectorGUI()
{
if (GUILayout.Button("ToUpperCase")) // this is displaying Btn
{
var customDialogBehaviour = target as CustomDialogPlayableAsset;
customDialogBehaviour.template.dialogText = customDialogBehaviour.template.dialogText.ToUpper();
serializedObject.ApplyModifiedProperties();
}
DrawDefaultInspector();
}
}
#endif
here is my Code for Time timeline Track