I think previously LocalToWorld component / proxy was used, how do I copy translation from the entity to the gameobject now?
LocalToWorldProxy is marked as deprecated.
I think previously LocalToWorld component / proxy was used, how do I copy translation from the entity to the gameobject now?
LocalToWorldProxy is marked as deprecated.
You can still just add the CopyTransformToGameObject component to your entity.
But it doesn’t work for me with Translation component attached (translation proxy is modified, but transform is not).
Or I’m doing something wrong.
Yep, it still uses LocalToWorld =|
LocalToWorld is a standard component of the TransformSystem, what’s wrong with using that? All entities that have a transform have a LocalToWorld component.
And it will. Translation itself it’s just convenient way of modifying LTW, without LTW is nothing. Anyway if you don’t want LTW just write your own CopyTo system with your own entity query.
No idea
Translation is marked as deprecated as well:
It’s proxy marked as deprecated, and not Translation and LTW itself, cause proxy should be replaced to new Conversion workflow.
I’m fine, as long as its not going to be dumped away at some version.
There should be a replacement for anything if its marked as deprecated, right?
Yes, GameObjectEntity and Proxy components are depreciated.
That’s not the same as depreciating the actual LocalToWorld component.
Don’t use LocalToWorldProxy.
The replacement is the conversion system.
Ok, got it. Thanks
Sorry for digging it out after a year, but it’s the most returned topic on Google searches when it comes to copying Translation to GameObject. Currently, we get messages encouraging usage of the new conversion workflow, but I don’t know how it should look in implementation. How can I add CopyTransformToGameObject component? There is no script like that on its own in the Entities package (although it is mentioned in my version of the package in the Scripting API documentation), the only scripts available for attaching to GO are the deprecated proxies. How it is done to implement this reflection of Entity Translation on GO’s Transform in the “new conversion workflow”?
@Mesayah , new conversion system is basically using ConvertToEntity scripts to initiate the convertion for a gameobject, and defining the components of the resulting entity via the Authoring scipts in the editor, or by custom Monobehaviors that implement IConvertGameObjectToEntity interface, and add the component manually in the Convert method.
Since we don’t have the CopyTransformToGameObjectAuthoring script provided (which I think should be handled in the future - all it takes is to add [GenerateAuthoring] attribute, if I can guess), we can’t use the neat Authoring from editor trick. So, you need to create your own monobehavor and add the CopyTransformToGameObject in the Convert method like this:
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
{
dstManager.AddComponentData(entity, new CopyTransformToGameObject());
}