KeldorKatarn
Topic Author
Posts: 193
Joined: 30 May 2014, 10:26

Re: Workflow to use Unity asset types in Blend unclear

27 Apr 2021, 17:10

#if UNITY_5_OR_NEWER
using ImageSourceType = UnityEngine.Texture2D;
#endif
That could maybe work in a ViewModel interface that's implemented by runtime and design time viewmodels. Everywhere else I'd consider that a layer violation and bad design.
2. Strict implementation of the MVVM pattern (Model = Unity Type, View = XAML, ViewModel = Noesis Types)
Binding against Unity Datatypes is not a MVVM violation. In a normal database application I'd also bind directly against a customer type in the model and not first wrap it into something else. That's not how MVVM works. The VM layer is about the logic, not about DataContainer types. That's exactly what C# recently created the new struct and record types for. But I digress.
Using Unity Types in the view model layer is a perfectly valid workflow and I disagree that it is a layer violation.
3. Have different implementations for Unity and Blend. If you correctly encapsulate this you can avoid a lof of fake classes. I will show you later, in my next post.

For Blend:
public class TerrainType
{
    public string Name { get; } = "Test Name";
    public BitmapImage Image { get; } = new BitmapImage(new Uri(@"\Blend\Textures\hexForest.png", UriKind.Relative));
}
For Unity:
public class TerrainType
{
    public string Name { get; }
    public Texture2D Image { get { return Tile.sprite.texture; }
    public Tile Tile { get; }
}
That might work in this use case but it's still a massive hack and in my opinion a code smell. I'm basically changing the API of a Unity asset to allow for this databinding to be less of an issue in Blend. That's bad software design in my opinion. When I design these types I don't want to think completely different layers and even that layer only in an application that's just a helper and mostly in the way to begin with.
The texture shouldn't be exposed to begin with on that type's API since Unity doesn't need it. It needs the tile to be put on the TileMap. The texture is of pure internal render use.

What I'll probably do here is create a mapping table of terraintype name to UI representative texture. That's probably better anyway since i'm not even sure yet if I'll stick with tile rendering for terrain or just use the tiles to mark the terrain type and have a hand-drawn map in the background.
However changing my asset type API to compensate for Blend workflow shortcomings are not good software design IMO.

So I'll probably go for the mapping instead, possibly in a ValueConverter. That won't work if I decide to extend terrain types, but it's limited in work to expand the UI to provide additional icons for new terrain types and maybe I can later put that mapping somewhere into an asset or autogenerated table or something or map it to a path and a procedurally generated filename that matches the right UI icon to the right terrain type. That's much cleaner I think.
Hot-reloading is implemented (it is off by default in 3.0). Please, read more about it in our Unity Tutorial.
Ah nice. I'm going to try that. If that works nicely enough for me I might even ditch Blend altogether.
Btw are you guys in contact with the team doing the Unity extensions for Rider? Rider seems to be the standard (and really best) IDE to work with Unity at the moment and there is already
a feature request to have Rider supporting XAML code completion and intellisense in a Unity project (right now that's not active unless the project is a WPF project). That would be immensely helpful. Maybe you can offer your support there and have some of your customer base upvote that feature request or even help get that done?
I think that would already help massively with work on Noesis type projects.
Have you tried this template for Visual Studio? That's the recommended structure and the one we are following in all our examples.
Yes my project layout is basically exactly the same. I still need to manually edit the Blend project file though since VisualStudio has no UI for changing the /obj/ folder location, you can only change the /bin folder. I don't want the /obj to show up at my Unity project root, I want that stuff to end up in a /Blend subfolder. That's why I need to hand edit the project file. Not sure if your template has that already done, it's basically the <BaseIntermediateOutputPath> tag. I think there's also a feature request for the VS team to have a UI for changing this.

Thanks for the quick responses. I think I'm slowly finding some hacks and workarounds to get the WPF project to cooperate maybe. I'm still not super happy with this workflow and I think a combination of XAML support in Unity projects for Rider + HotReloading would be the better option.

Tags:
 
User avatar
jsantos
Site Admin
Posts: 3122
Joined: 20 Jan 2012, 17:18
Contact:

Re: Workflow to use Unity asset types in Blend unclear

28 Apr 2021, 11:35

Btw are you guys in contact with the team doing the Unity extensions for Rider? Rider seems to be the standard (and really best) IDE to work with Unity at the moment and there is already
a feature request to have Rider supporting XAML code completion and intellisense in a Unity project (right now that's not active unless the project is a WPF project). That would be immensely helpful. Maybe you can offer your support there and have some of your customer base upvote that feature request or even help get that done?
I think that would already help massively with work on Noesis type projects.
That's a wonderful idea. We already have autocomplete support in XamlToy but extending this to Rider with all our extensions would be great.

Can you provide a contact for us? It gives me the impression you are quite connected to that community.
Yes my project layout is basically exactly the same. I still need to manually edit the Blend project file though since VisualStudio has no UI for changing the /obj/ folder location, you can only change the /bin folder. I don't want the /obj to show up at my Unity project root, I want that stuff to end up in a /Blend subfolder. That's why I need to hand edit the project file. Not sure if your template has that already done, it's basically the <BaseIntermediateOutputPath> tag. I think there's also a feature request for the VS team to have a UI for changing this.
Great suggestion. I just created #1988 to track this.
Thanks for the quick responses. I think I'm slowly finding some hacks and workarounds to get the WPF project to cooperate maybe. I'm still not super happy with this workflow and I think a combination of XAML support in Unity projects for Rider + HotReloading would be the better option.
Thanks for your feedback. Let's see if we can redirect that frustration energy to make NoesisGUI better.
 
KeldorKatarn
Topic Author
Posts: 193
Joined: 30 May 2014, 10:26

Re: Workflow to use Unity asset types in Blend unclear

28 Apr 2021, 18:02

Can you provide a contact for us? It gives me the impression you are quite connected to that community.
Not sure if I'm connected or not, but this is already being tracked by JetBrains in their tracker. So far it seems there's just a lack of demand for this feature.
Maybe you guys can offer your support.

https://youtrack.jetbrains.com/issue/RIDER-18253
https://youtrack.jetbrains.com/issue/RIDER-18467

Although that might actually be the wrong place. That's for Rider itself. The Unity support expansion for Rider lives here:

https://github.com/JetBrains/resharper-unity

However... If Rider supported Noesis out of the box it might be possible to work in Rider on both projects the same way. But that's be up to the Jetbrains team to figure out.
From what I can see they just need to be made to consider this an important feature. I'm not sure what your bigger customers use as an IDE, if any of them use Rider maybe
they can put their weight behind this? Right now I can do little more than upvote it :D
 
User avatar
jsantos
Site Admin
Posts: 3122
Joined: 20 Jan 2012, 17:18
Contact:

Re: Workflow to use Unity asset types in Blend unclear

30 Apr 2021, 11:36

I know a few customers are using Rider, I will contact them about this.

I also wrote a message in that issue, let's see if they answer.
 
KeldorKatarn
Topic Author
Posts: 193
Joined: 30 May 2014, 10:26

Re: Workflow to use Unity asset types in Blend unclear

30 Apr 2021, 12:31

Rider has fantastic integration with Unity so I'd expect that a lot of people are using it. Considering that Rider also has a XAML Designer, it'd be the ideal IDE to work with Noesis in Unity.

Who is online

Users browsing this forum: sgonchar and 1 guest