BabylonJS / BabylonToolkit

Home of the community maintained Unity & Unreal exporters for Babylon.js
173 stars 46 forks source link

error TS2430: Interface 'Document' incorrectly extends interface 'FontFaceSource'. #48

Closed ideletemyself closed 2 years ago

ideletemyself commented 2 years ago

../../AppData/Roaming/npm/node_modules/typescript/lib/lib.dom.d.ts(4227,11):` error TS2430: Interface 'Document' incorrectly extends interface 'FontFaceSource'. The types of 'fonts.forEach' are incompatible between these types. Type '(callbackfn: (value: FontFace, value2: FontFace, set: Set) => void, thisArg?: any) => void' is not assignable to type '(callbackfn: (value: FontFace, key: FontFace, parent: FontFaceSet) => void, thisArg?: any) => void'. Types of parameters 'callbackfn' and 'callbackfn' are incompatible. Types of parameters 'parent' and 'set' are incompatible. Type 'Set' is missing the following properties from type 'FontFaceSet': onloading, onloadingdone, onloadingerror, ready, and 6 more. ../../AppData/Roaming/npm/node_modules/typescript/lib/lib.dom.d.ts(5223,11): error TS2300: Duplicate identifier 'FontFace'. ../../AppData/Roaming/npm/node_modules/typescript/lib/lib.dom.d.ts(5241,13): error TS2300: Duplicate identifier 'FontFace'. ../../AppData/Roaming/npm/node_modules/typescript/lib/lib.dom.d.ts(5272,11): error TS2300: Duplicate identifier 'FontFaceSetLoadEvent'. ../../AppData/Roaming/npm/node_modules/typescript/lib/lib.dom.d.ts(5276,13): error TS2300: Duplicate identifier 'FontFaceSetLoadEvent'. Assets/[Babylon]/Template/Typings/babylon.d.ts(28991,81): error TS2304: Cannot find name 'OffscreenCanvas'. Assets/[Babylon]/Template/Typings/babylon.d.ts(38573,162): error TS2304: Cannot find name 'OffscreenCanvas'. Assets/[Babylon]/Template/Typings/babylon.d.ts(39014,54): error TS2304: Cannot find name 'OffscreenCanvas'. Assets/[Babylon]/Template/Typings/babylon.d.ts(39016,62): error TS2304: Cannot find name 'OffscreenCanvasRenderingContext2D'. Assets/[Babylon]/Template/Typings/babylon.d.ts(39107,67): error TS2304: Cannot find name 'OffscreenCanvas'. Assets/[Babylon]/Template/Typings/babylon.d.ts(40361,54): error TS2304: Cannot find name 'OffscreenCanvas'. Assets/[Babylon]/Template/Typings/babylon.d.ts(40363,62): error TS2304: Cannot find name 'OffscreenCanvasRenderingContext2D'. Assets/[Babylon]/Template/Typings/babylon.d.ts(41610,67): error TS2304: Cannot find name 'OffscreenCanvas'. Assets/[Babylon]/Template/Typings/babylon.d.ts(84365,16): error TS2304: Cannot find name 'MSGesture'. Assets/[Babylon]/Template/Typings/babylon.d.ts(84407,78): error TS2304: Cannot find name 'NavigatorUserMediaSuccessCallback'. Assets/[Babylon]/Template/Typings/babylon.d.ts(84407,128): error TS2304: Cannot find name 'NavigatorUserMediaErrorCallback'. Assets/[Babylon]/Template/Typings/babylon.d.ts(84408,75): error TS2304: Cannot find name 'NavigatorUserMediaSuccessCallback'. Assets/[Babylon]/Template/Typings/babylon.d.ts(84408,125): error TS2304: Cannot find name 'NavigatorUserMediaErrorCallback'. Assets/[Babylon]/Template/Typings/babylon.d.ts(84409,74): error TS2304: Cannot find name 'NavigatorUserMediaSuccessCallback'. Assets/[Babylon]/Template/Typings/babylon.d.ts(84409,124): error TS2304: Cannot find name 'NavigatorUserMediaErrorCallback'. Assets/[Babylon]/Template/Typings/fonts.d.ts(47,11): error TS2300: Duplicate identifier 'FontFace'. Assets/[Babylon]/Template/Typings/fonts.d.ts(64,11): error TS2300: Duplicate identifier 'FontFaceSetLoadEvent'.

System.UnityTools:CompileProjectScriptBundle (System.IO.StreamWriter,string,string,string,string,bool,string) CanvasTools.CanvasToolsExporter:ExportProject (string,EditorSceneInformation,EditorBuildType,UnityEngine.Transform[],string,string) CanvasTools.CanvasToolsExporter:BuildProject (EditorBuildType,UnityEngine.Transform[],string,string) CanvasTools.CVPanel:OnGUI () UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)


Getting the following error when trying to Compile Script. It's a newly created Unity project and I just installed both NPM and Typescript from NPM. Not sure what I'm doing wrong?

I'm on Windows if that makes any difference..

Any help is appreciated. Thanks!

MackeyK24 commented 2 years ago

Seems like a TypeScript version issue.

We no longer use font.d.ts ... In the new typescript fonts are included.

I would get rid of font.d.ts in typings folder ... or better yet. get a clean [Babylon] folder...

I would try the updated babylon toolkit (last stable build) https://github.com/BabylonJS/UnityExporter/tree/master/Redist/Alpha

ideletemyself commented 2 years ago

Yes. You were right I was running a super old version.

So that error is gone and I can compile but now I'm getting this new error about Lightmapping.lightingSettings here's the full error I get when I go to build:

Exception: Lightmapping.lightingSettings is null. Please assign it to an existing asset or a new instance. UnityEditor.Lightmapping.get_lightingSettings () (at :0) System.UnityTools.GetLightingSettings () (at <9d72ee5c2677443c884df4ea1edc1084>:0) System.UnityTools.GetLightmapBakeMode () (at <9d72ee5c2677443c884df4ea1edc1084>:0) System.UnityTools.ValidateLightmapSettings () (at <9d72ee5c2677443c884df4ea1edc1084>:0) CanvasTools.CanvasToolsExporter.ExportProject (System.String project, EditorSceneInformation info, EditorBuildType mode, UnityEngine.Transform[] selection, System.String filename, System.String folder) (at <9d72ee5c2677443c884df4ea1edc1084>:0) CanvasTools.CanvasToolsExporter.BuildProject (EditorBuildType mode, UnityEngine.Transform[] selection, System.String filename, System.String folder) (at <9d72ee5c2677443c884df4ea1edc1084>:0) CanvasTools.CVPanel.OnGUI () (at <9d72ee5c2677443c884df4ea1edc1084>:0) UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition, UnityEngine.Rect viewRect) (at :0) UnityEditor.DockArea.DrawView (UnityEngine.Rect viewRect, UnityEngine.Rect dockAreaRect) (at :0) UnityEditor.DockArea.OldOnGUI () (at :0) UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize, System.Action onGUIHandler, System.Boolean canAffectFocus) (at :0) UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Action onGUIHandler, System.Boolean canAffectFocus) (at :0) UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Action onGUIHandler, System.Boolean canAffectFocus) (at :0) UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Boolean canAffectFocus) (at :0) UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUIRaw (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) (at :0) UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUI (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) (at :0) UnityEngine.UIElements.IMGUIContainer.HandleEvent (UnityEngine.UIElements.EventBase evt) (at :0) UnityEngine.UIElements.CallbackEventHandler.HandleEventAtTargetPhase (UnityEngine.UIElements.EventBase evt) (at :0) UnityEngine.UIElements.MouseCaptureDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at :0) UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) (at :0) UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at :0) UnityEngine.UIElements.EventDispatcher.ProcessEventQueue () (at :0) UnityEngine.UIElements.EventDispatcher.OpenGate () (at :0) UnityEngine.UIElements.EventDispatcherGate.Dispose () (at :0) UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at :0) UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at :0) UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at :0) UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at :0) UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at :0) UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at :0) UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at :0) UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at <681fdbd9389e4d6e8755fe4f632bfbbe>:0)

I tried to just disable Export Lightmaps but that didn't seem to make any difference. This is just a new scene with a camera & directional light and a couple GameObjects, nothing crazy. Thanks again for your help.

ideletemyself commented 2 years ago

For anyone who runs into my 2nd issue about the Lightmapping.lightingSettings error...

The fix is to go to Window > Rendering > Lighting and then to select or create and then select a lighting setting in "Lighting Settings" at the top of the window.