#Authoring script edits Transform but changes aren't shown in Game view

1 messages · Page 1 of 1 (latest)

urban granite
#

Context: I'm making a Pong clone to learn about ECS in Unity 2023.2.0.

When editing the transform directly, the changes are shown in the Scene and Game views immediately.
My BallAuthoring script needs to make sure the ball is always shown in the middle of the game area, in edit and play mode.
This is true for the Scene view, but the Game view is desynced, which I think is related to the baking system.
I tried adding GetComponent<Transform>() and DependsOn(authoring.transform) to my baker, but it made no difference.
How do I tell my baker to track changes made to the transform from this script? Is this even the right approach?

urban granite
pale crag
#

Authoring objects should not move, only runtime entitits should.

#

You are on version which is not officially supported

#

Check if you have graphics package installed

#

For rendering

urban granite
#

The authoring object is only being moved in the editor to signify where the runtime entity should be spawned. The graphics package is installed. Keep in mind, everything I'm talking about is happening in edit-mode, not play-mode.

urban granite
#

I understand that GetComponent and DependsOn aren't what I'm looking for, because that's more about detecting changes in my dependencies. For me, it's the other way around.

wet copper
#

makes me wonder how bakers are triggered by transform changes 🤔

urban granite
#

Me too.

#

Because I'm modifying the transform, but the baker isn't triggered.

#

I've read most of the package documentation, and I don't remember anything like this being covered. So I might just chalk it up to a bug and accept that it's desynced in the editor.

#

At least it's not a problem once I start the game.

wet copper
#

i would say its some sort of bug but you're probably an unusual case (though changing transform data via editor script isnt really unheard of)

#

there's a system that is responsible for live conversion ; EditorSubSceneLiveConversionSystem, you could dig through that

urban granite
#

Yeah, I was trying to find out how to trigger it manually as a stop-gap solution.

#

EditorSubSceneLiveConversionSystem doesn't seem to exist.

wet copper
#

ah they mustve renamed it, im on an older version

urban granite
#

I tried searching for it in the outdated scripting API docs, couldn't find it.

wet copper
#

you can go to the source for* DependsOn, find the list of dependencies, see where it's used, you'll end up in some Bake function somewhere

#

thats how i found it anyway

urban granite
#

It was made internal.

pale crag
#

while it's open it's in authoring mode