Updating 2D screen

Hey guys, i have created a prefab / template for my 2D screen so I can easily edit it and so its being applied in to every level, so i dont need to manually set some attribute in every level , its time consuming when you have over 40 levels. I have home button and Music button right next to each other, but i decided to move these buttons on the other side of screen, i applied changes into template, home button is there but not music button, i found out that when i change position of music button by “any value like 0.01” and then put the original value back then the music button is on the position I want, but i need to change any attribute so the button is “on the position”.

Here should be music button, but its not .

Here is my music button, notice the position of it, i will change Y position from 50 to 49 and then put back to 50

And see, button is there:

I need to do it manually in each level, so i want to know how to do it so i dont need to manually change the value so the position or button is activated.

Im not sure if its a bug or im doing something wrong, but you can see that Home button is correctly moved on position i want without changing anything.

Anyway, it happened to me before but i didnt care so much as i had just few levels, but now it is really bothering me.

Is the template the button entity or the UI screen layout in this case?

If it’s just the button entity, the transform (position, rotation, scale) are not stored in the root entity of the template as in practise, a template instance is usually not in the same place.

Rather than a template per button, I would do a template per layout (ie an element group) and the children would be the two buttons.

If this is what you are doing already, can you create a new project with scenes and just the buttons to showcase the issue please?

image

2D screen itself is templated, you can see the picture

In which case, can you create a new project with scenes and just the buttons to showcase the issue please?

1 Like

Im sorry but project is large and it would take lots of time to reproduce the problem, and it also doesnt happen every time, as you could see, home button was moved properly.

Hi @smokys,

Did you happen to use undo when working with the templates? From what I’ve seen, undoing action relating to changes that get committed to a template seem to have this problem.

I don’t remember if following this process fixed all of the template objects off of the top of my head, but you might want to give it a try:

Hello, no undo didnt happen in this case. In editor i can see exactly the position of a button(it is where it should be), but its not ingame, when i change position by 1 (XYZ, doesnt matter) then button appear out of sudden.

You can copy and paste both entities and assets between projects to speed up the process.

Sent you pm.

Not fixed, i find out that it happens to a lot of elements, not just button. I tried to update a 2D screen for 40 levels at once and only like 15 of them was good, but other had different position, no texture attached, even they had it before updating, outlines of text were not applied and many more.

And for some was enough to change the position by 1 and then put it back, others required more attention.
I believe this might be bug of template system.

On the instances/scenes where it isn’t correct, have you tried clicking revert on template instance?

Nope i havent tried that yet, i will though.

Hi @smokys! I’m curious if it could be related to my issue with templates. That is also not solved.

https://forum.playcanvas.com/t/about-templates

1 Like

It looks like the same issue honestly, but with difference that i also encountered this with bad text outlining, (color was not set to what it should), and even some textures were not applied at all.

Everything is fine in the scene where template was created.