2D Toolkit Forum

2D Toolkit => Support => Topic started by: test84 on February 10, 2014, 11:01:11 pm

Title: Is this how we're supposed to move a progress bar? Or is it a bug?
Post by: test84 on February 10, 2014, 11:01:11 pm
Hi,

I have two progress bars in my game and I need to move one in front of the other one sometimes. What I've done is this:

second_progress_bar.transform.position = first_progress_bar.transform.position;

(I also tried to copying transform.position of the 2nd one into a temp variable and then passing it to first one's, no luck)

See the images and please note the position!

(http://s29.postimg.org/j2k92kzbn/Screen_Shot_2014_02_11_at_2_31_02.png) (http://postimg.org/image/j2k92kzbn/)

(http://s29.postimg.org/q722bm6kz/Screen_Shot_2014_02_11_at_2_31_17.png) (http://postimg.org/image/q722bm6kz/)(http://)


but the second_progress_bar doesn't change it's location. In the editor I can see that it has the first_progress_bar's position in it's transform component, but in the game and scene view, it has some offset and is wrong.

Am I missing something?

Thanks.
Title: Re: Is this how we're supposed to move a progress bar? Or is it a bug?
Post by: unikronsoftware on February 11, 2014, 09:39:30 am
Should work fine - it doesn't modify the position in there. What happens if you move it with the unity widget? If you can't figure this out, post exact steps to reproduce it and I'll try and work out why this is happening.
Title: Re: Is this how we're supposed to move a progress bar? Or is it a bug?
Post by: test84 on February 11, 2014, 09:34:22 pm
Should work fine - it doesn't modify the position in there.

I didn't understand you there.

What happens if you move it with the unity widget? If you can't figure this out, post exact steps to reproduce it and I'll try and work out why this is happening.

It works fine in a new and clean scene but doesn't in the game. Strange thing is values of transform component are correct but it doesn't go where it's supposed to be.
Title: Re: Is this how we're supposed to move a progress bar? Or is it a bug?
Post by: test84 on February 11, 2014, 09:43:32 pm
Very strange, I tried to set each x, y and z properties of the 2nd progress bar's transform component from the 1st one via copy and paste in edit mode, but to my surprise, the same bug persists. Meaning that the 2nd progress bar has the 1st one's position but it stands at an incorrect position. In fact, the Y is wrong.
Title: Re: Is this how we're supposed to move a progress bar? Or is it a bug?
Post by: unikronsoftware on February 11, 2014, 09:48:51 pm
Is the static flag set? Top right of the inspector. Stuff doesn't move if you set the static flag
Title: Re: Is this how we're supposed to move a progress bar? Or is it a bug?
Post by: test84 on February 11, 2014, 10:23:53 pm
No it's not.
Title: Re: Is this how we're supposed to move a progress bar? Or is it a bug?
Post by: unikronsoftware on February 11, 2014, 10:51:45 pm
I'm at a loss. I can take a look if you post a minimal repro case?
Title: Re: Is this how we're supposed to move a progress bar? Or is it a bug?
Post by: test84 on February 12, 2014, 01:14:31 pm
Thanks man. I have no idea why this happens. I tried to get away from the problem by doing some kind of hack since I'm under a lot of constraints.

I'll get back to you if I face this again.

Keep up the great work.