2D Toolkit Forum

2D Toolkit => Support => Topic started by: PreciousL on May 14, 2012, 02:52:42 pm

Title: Frequent Saving with Anchors
Post by: PreciousL on May 14, 2012, 02:52:42 pm
When anchors are added to the scene then every action that is done in the editor causes you to have to re-save your file.  Even saving the file makes it so you have to save the file again.

So, if you are like me and hate to see that asterisk denoting that there is unsaved data in your Unity file or you are trying to work in a team and constantly having an unsaved file is leading to versioning issues, one possible solution is to add:

if(_transform.localPosition != anchoredPosition + new Vector3(offset.x, offset.y, 0))

before line 77 in the 'tk2dCameraAnchor.cs' file.  I don't see it causing any issues and it sure does make me less neurotic.  :)
Title: Re: Frequent Saving with Anchors
Post by: unikronsoftware on May 14, 2012, 05:08:57 pm
Nice find, I've sorted it in the codebase now.
Title: Re: Frequent Saving with Anchors
Post by: asdasd on October 21, 2013, 01:48:06 pm
In 2.2 same issue. Fixed it by replacing "AnchorCamera" with "_anchorCamera" on line 134.
Title: Re: Frequent Saving with Anchors
Post by: unikronsoftware on October 21, 2013, 04:36:21 pm
Just had a look at that. That was unintentional - thats for bringing it up. To fix it properly, revert to (use AnchorCamera instead of _anchorCamera), and in UpdateTransform, the line:
tk2dCamera = ...;
should read:
      tk2dCamera currentCamera = (AnchorTk2dCamera != null && AnchorTk2dCamera.CameraSettings.projection != tk2dCameraSettings.ProjectionType.Perspective) ? AnchorTk2dCamera : null;
and everywhere else in this function, it should use currentCamera instead of tk2dCamera.

This will be fixed in the next release.