About templates

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
image

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.

image

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.

Sorry, it took me a bit of rereading to understand your question, but I think I have it now.

Just to confirm:

You’re saying you:

  • Created a template from the entity at the top of the image
  • Would like the remaining entities to take the settings of the template that was created at the top

You would like to know:

  • Is there an easier way to convert the remaining objects to template other than deleting them and adding them back in one at a time.

If this understanding is correct, I don’t think there is really an easier way. In the use case of the image you posted you could make the process easier by just abusing Ctrl+D on the template to duplicate it quickly, but for more advanced placement I don’t think there are too many good options.

Yes, I think that’s what I mean. So if you built a complex scene with many of the same objects and you built this scene before the template system was introduced, or you forgot to use the template system, then you have a lot of work to do…