Skip to content
This repository has been archived by the owner on Jan 4, 2022. It is now read-only.

Subscene Support #19

Open
psuong opened this issue Mar 20, 2020 · 8 comments
Open

Subscene Support #19

psuong opened this issue Mar 20, 2020 · 8 comments
Assignees
Labels
help wanted Extra attention is needed question Further information is requested

Comments

@psuong
Copy link
Member

psuong commented Mar 20, 2020

With runtime conversion possibly not the ideal workflow, it would be a good idea for me to support subscenes very soon. One of the issues I've been running into is adding a component object such as a texture or a material to an entity in a subscene - as the entity when loaded from the subscene does not have the said material.

@psuong psuong added help wanted Extra attention is needed question Further information is requested labels Mar 20, 2020
@psuong psuong self-assigned this Mar 20, 2020
@psuong
Copy link
Member Author

psuong commented Apr 3, 2020

Putting this on hold for now until I figure out how to add referenced based objects on scene conversion.

@psuong
Copy link
Member Author

psuong commented Sep 10, 2020

Alright, with subscenes working with managed component datas, I think it would be best to start adding support to generate the vertices in subscenes. This might work really well with a procedural renderer instead of building meshes in runtime (issue #60). Runtime support will still be added in case the entire hierarchy needs to be rebuilt.

@psuong
Copy link
Member Author

psuong commented Sep 14, 2020

image
Subscenes work but looks like the canvas data isn't exactly baked nicely. So as a workaround - I'll bake information to a scriptable object which I'll read during conversion to generate the correct vertices.

That said, Unity doesn't like me attempting to override the TransformSystem without write groups (which I have no idea how to do in a GameObjectConversionSystem). So as an alternative I will likely write up a minimal transformation system without using rotations (I don't expect myself or users to really be rotating vertices (technically you can defer this to a shader).

@psuong
Copy link
Member Author

psuong commented Sep 15, 2020

image
Okay baked data into a scriptable object that is read on conversion. The results are quite nice when loading in a subscene! In place transform data is in - but supplement transform systems will need to be in. This means that we don't store matrix information anymore, but just the minimal amount of data to create the matrix (in this case just translation (float2) and scale (float2)).

Additionally, some clean up will be required on the canvas entity.

@psuong
Copy link
Member Author

psuong commented Sep 20, 2020

image
Text is now supported again!

@psuong
Copy link
Member Author

psuong commented Sep 20, 2020

image
Also some additional quality of life features. Names will be applied directly to the entity on the initial frame - this is an Editor only system and currently lives in UGUIDOTS.Conversions.Diagnostic assembly definition (also you will need to enable UGUIDOTS_DEBUG in your scripting defines - this is only meant to be an Editor only tool!)

Without it - the EntityDebugger will look like so:

image

Lastly, since static functions and properties which return a texture and default material don't play nicely with inactive subscenes - the SharedTexture and SharedMaterial component data contain some Get methods which will assign the texture if the value is null. Currently - I assume an unassigned material/image has the intention of using Unity's default.

@psuong
Copy link
Member Author

psuong commented Oct 4, 2020

So this is pretty much a redesign of the entire framework system. For StretchImageSystem ideally if the aspect ratio is not the same, I need to rebuild stretched images.

Currently, I'm thinking that the Update loop should have the step where all of the indices are rebuilt in the buffer. And in late update, the mesh should be rebuilt to handle a different aspect ratio.

Rebuilding Images

For most intensive purposes images just need to rebuild in their current indices since the # of vertices aren't intended to change.

Rebuilding Text

I think this is where it becomes really tricky. For most intensive purposes my workflow with handling text is knowing which text is dynamic and which is static. Static text like labels wil llikely have a typical TextMeshProUGUI component without any other additional components. But, if I wanted to manipulate text, just adding a custom MonoBehaviour which references TextMeshProUGUI would mean that text is intended to be manipulated. to emulate this kind of workflow - batching all the text to be the last kind of meshes in the batch would make sense.

@psuong
Copy link
Member Author

psuong commented Oct 25, 2020

screen-res-working

Text and image scaling is working much more nicely now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant