Hello Guest

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - cmeynard

Pages: [1]
1
Support / Zoom Factor and resize of UI Button
« on: January 19, 2014, 01:33:54 pm »
Using Unity 4 and 2dToolkit (latest version, just purchased a couple of days ago)

Very new to 2D Toolkit and  still finding my way around.

(Existing)
I have a finished game that was creating too many draw calls. I am now adding the 2D Toolkit for batching. My issue is that I have yet to make one button work (yeshhh). I had a simple GUIbutton on the Main Camera. It is a zoom button that changes the ortho field. This button remains the same size throughout the process.

(New)
Created a 2dToolkit and sprite sheet with zoom image. Created a basicButton in 2dtoolkit. Assigned sprite (awesome). Created a HUD empty game object to hold scripts. When the basicButton is pushed it calls the script in HUD to resize the tk2dCamera zoom factor (awesome). Attached the button on to the camera so it is always in correct position in camera (awesome). Click on the button and the zoom factor changes (awesome) BUT the button also changes size which is not the desired effect. Regardless of the zoom factor the button needs to stay the same size as originally set on the camera. What am I doing wrong? This is perfect as a unity GUIButton.
Question: How do I maintain the button size when zoom factor changes?


Also, the button is on the lower right corner. When I change the zoom factor the button goes off screen even though it is attached to camera. The button needs to maintain position on camera. Again, what am I doing wrong? This was all cool in Unity GUI. (alas...no more hair to pull out). Starting to worry if this was a good purchase. Concerned about all of the other UI elements in game.

Question: How do you keep a button position relative to the camera when messing with zoom factor?

Pages: [1]