2D Toolkit > Releases

2D Toolkit 2.5.8.16

<< < (2/2)

baconbanditgames:

--- Quote from: wagenheimer on September 05, 2019, 06:02:11 pm ---Is there an update to work on 2019.3?

"tk2dCamera.GetGameViewSize - has a Unity update broken this?
This is not a fatal error, but a warning that you've probably not got the latest 2D Toolkit update.

System.NullReferenceException: Object reference not set to an instance of an object
  at tk2dCamera.Editor__GetGameViewSize (System.Single& width, System.Single& height, System.Single& aspect) [0x00021] in D:\Games\Green Sauce Games\Tales of the Orient - The Rising Sun\Assets\TK2DROOT\tk2d\Code\Camera\tk2dCamera.cs:371
UnityEngine.Debug:LogError(Object)
tk2dCamera:Editor__GetGameViewSize(Single&, Single&, Single&) (at Assets/TK2DROOT/tk2d/Code/Camera/tk2dCamera.cs:430)
tk2dCamera:GetScreenPixelDimensions(tk2dCamera) (at Assets/TK2DROOT/tk2d/Code/Camera/tk2dCamera.cs:709)
tk2dCamera:UpdateCameraMatrix() (at Assets/TK2DROOT/tk2d/Code/Camera/tk2dCamera.cs:782)
tk2dCamera:OnEnable() (at Assets/TK2DROOT/tk2d/Code/Camera/tk2dCamera.cs:275)
"

--- End quote ---

I haven't tested this extensively, but a quick workaround is to update the Editor__GetGameViewSize function with this:


--- Code: ---public static bool Editor__GetGameViewSize(out float width, out float height, out float aspect) {
width = Screen.width;
height = Screen.height;
aspect = (float)width / (float)height;
return true;
}
--- End code ---

This will not work if you select "Free Aspect" - you must select an explicit resolution in the editor.

It does seem to work with any chosen, explicit resolution. I have not checked to see if this has any negative effects, use at your own risk!

Also worth noting that it may not work with how you have your tk2d camera(s) set up!

Note that this error happens in Unity 2019.3+ because Unity removed UnityEditor.GameView.GetMainGameView. As Unity 2019.3 is still in beta, most plugin authors likely haven't looked into this issue. I'm thinking we'll see a more formal solution from the community and/or other plugin authors after 2019.3 is officially released, at which point a proper solution can hopefully be implemented.

birdkingz:
Thanks for the fix!

zblack:
May have found a bug in tk2dUITextInput Start():


--- Code: ---if (tk2dUIManager.Instance__NoCreate != null) //__BUG__ if tk2dUIManager doesn't exist yet, AnyPress doesn't get added!
{
tk2dUIManager.Instance.OnAnyPress += AnyPress;
}
wasOnAnyPressEventAttached = true;
--- End code ---

Curious why this is using Instance__NoCreate instead of just instantiating it?

unikronsoftware:
Its because you can have the UI separate to the instance (its usually in a scene). So it should be created by then, or if it isn't it hasn't loaded yet.

Navigation

[0] Message Index

[*] Previous page

Go to full version