<p>This error occurs when you try to convert a list of type 'System.Collections.Generic.List<code>1[System.Object]' to a list of type 'System.Collections.Generic.IEnumerable</code>1[UnityEditor.Timeline.ITimelineItem]'. The two types are not compatible, so you cannot perform this conversion directly.</p>
<p>To resolve this error, you can try to convert the list of objects to a list of ITimelineItem objects before passing it to the method that expects an IEnumerable<ITimelineItem>. You can do this using LINQ's Cast<T>() method. Here's an example:</p>
<pre><code>List&lt;object&gt; objectList = // your list of objects
IEnumerable&lt;ITimelineItem&gt; timelineItemList = objectList.Cast&lt;ITimelineItem&gt;();
</code></pre>
<p>This code first converts the List<object> to an IEnumerable<ITimelineItem> using the Cast<ITimelineItem>() method. Once you have an IEnumerable<ITimelineItem>, you can pass it to the method that expects it without any issues.</p>
<p>Alternatively, you can modify the method that expects an IEnumerable<ITimelineItem> to accept a list of objects instead. Then, you can perform the conversion to ITimelineItem objects within the method using the same Cast<ITimelineItem>() method</p>
rgumentException Object of type SystemCollectionsGenericList1SystemObject cannot be converted to type SystemCollectionsGenericIEnumerable1UnityEditorTimelineITimelineItem

原文地址: https://www.cveoy.top/t/topic/hlQX 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录