About templates

Templates make everything easier, but it takes a while to fully understand how it works.

I was working on my Instruction template. I have a couple of entities from that tempIate with an override name, like the entity below. I disabled the Area entity from it and in the scene I changed the position of the Button.


I applied the changes with right click on Position and choose apply to “MoveInstruction”. (I think this option name should be “Instruction” since this option will apply the change to all other entities from the same Instruction template and not only this MoveInstruction entity).

In the editor everything looks like how it should be.

But in the launch it goes wrong.

The position change of the Button entity is only changed in the entity where I did the change. For example the red template has the orginal position because I didn’t make a change from that entity.

Offcourse I refreshed the pages but the results stay the same.

Just before I want post this topic, I discover what the problem is. I don’t know if it is a bug or not, but when you change the position of the entity, the Margin of the element is also changing. When applying this change too, everything is okay again.

A good ending story.


That sounds like as designed. The margin changes with position or more accurately, the margin controls what the position of an element should be which would explain the issue you were seeing.

When I think about it, it sounds logical indeed. But the strange thing is that the editor shows something different as the launch.

Yeah, that worries me too. Trying to work out if that’s a UI issue or a template one :thinking:.

Any ideas on this one @zpaul?

My template clones are apparently very stubborn. They no longer listen to changes at all. I have now managed to get everything right in the launch while everything is mixed up in the editor.

In the editor:

In the launch:

Would you be able to branch what you have at the moment and give me access to the project please (yaustar) and I can try to take a look tomorrow.

You are already in the project. I made you admin so I think you can create a new branch yourself or you can fork the project. (I have already made a checkpoint).

Can you confirm the checkpoint that has the issue please? :slight_smile: There should be a short id in the commit message of checkpoint in the version control dialog.

It’s currently the last checkpoint with id d8017c5.

1 Like

I’ve forked the project so we can look at it without affecting you or your project.

1 Like

I reviewed the project, templates seem to work as expected. Please note that a UI entity may have Element (and related to it ‘position’) overrides that cannot be “applied” for UI implementation-related reasons, @vaios can explain more. Please maybe add him to your project as well, he is a member of our team. You may also find our version control (checkpoints and branches) useful: https://developer.playcanvas.com/en/user-manual/version-control/

@zpaul There’s a couple of entities that don’t match up. For example

Looks like this in the Editor:

But in game:

Whether that’s a template or UI issue is something that we need to look at.

1 Like

Some values related to UI elements are not supposed to be saved in template assets (they are relevant for template instances only). What is saved in the database for that instance seems to be correct (because the database values are used at run time). @vaios would probably have to check why it looks different in the editor.

1 Like

I have created a template from an existing entity. This is the first entity on the image. I want to make from all other entities on the image also a template of this new template. Is there a way to do this or do I have to remove all entities and reimporting these as a template? For now this is not problem, but if you have a big scene it could be.


I actually ran into this issue recently, and for me it seemed to have a bit to do with undos. If I remember correctly, I fixed it by:

  • committing a slight positional change to the template
  • changing the affected (non updating) entity’s position slightly
  • reverting that override back to the template

A bit tedious, but easier than resetting everything via overrides.

Hi @eproasim! I think you misunderstand my question, or I misunderstand your answer. I want to turn entities that are no template into an existing template.

Sorry @Albertos, I started reading the thread from the beginning, and didn’t notice the change in subject.

Though I have a moment now, could you elaborate a bit on the question?

Sorry for the confusion. I should have opened a new topic for this. The first part of this topic is still waiting on bug fixes in the template system I guess.

I have a couple of entities in my scene that I want turn into one template. I can turn one entity into a template, but how to do this for all of them? If I do it one by one I get a lot of same templates, which is not the intention. (The result should be a couple of entities that are the same template).

Have you considered just putting all of them as children of an empty entity and templateing that? I may be easier to do it that way.

If it is a child of a template and I make a change in the child that change is not applied to the other children.