Hello Guest

Author Topic: Is this how we're supposed to move a progress bar? Or is it a bug?  (Read 5925 times)

test84

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
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!






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.
« Last Edit: February 10, 2014, 11:16:48 pm by test84 »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Is this how we're supposed to move a progress bar? Or is it a bug?
« Reply #1 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.

test84

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
Re: Is this how we're supposed to move a progress bar? Or is it a bug?
« Reply #2 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.

test84

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
Re: Is this how we're supposed to move a progress bar? Or is it a bug?
« Reply #3 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.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Is this how we're supposed to move a progress bar? Or is it a bug?
« Reply #4 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

test84

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
Re: Is this how we're supposed to move a progress bar? Or is it a bug?
« Reply #5 on: February 11, 2014, 10:23:53 pm »
No it's not.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Is this how we're supposed to move a progress bar? Or is it a bug?
« Reply #6 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?

test84

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
Re: Is this how we're supposed to move a progress bar? Or is it a bug?
« Reply #7 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.