Topic Author
Posts: 19
Joined: 09 May 2014, 03:21

NoesisToUnity CodeSmith Template

30 May 2015, 00:25

I'll be placing this on GitHub.

For simple cases, this CodeSmith Generator template will produce a MonoBehaviour that you can use in conjunction with NoesisGUI in Unity. Place the NoesisGUIPanel and the generated behavior on the same GameObject (for example -- on the Camera).

For each XAML, two C# files are generated. One C# file contains property definitions for each named element in the XAML. The other C# file contains an Awake function that calls InitializeComponent().

The C# file that contains the Awake function is only created if it does not exist, otherwise I leave it alone. Therefore you can put whatever code you need in that file. (the .g.cs file is the one that gets overwritten every time, the .cs file gets left alone, if you're used to Visual Studio you probably have seen this pattern once or twice)

This only handles extremely simple cases -- which turns out to be all I need right now. If someone else ends up using it and needs it to do more, or if I end up needing more than this at some point, I'll update it. I'm not quite ready to set it up on GitHub.

As is normal, generated files are yours under whatever license you choose to apply.

The CST files themselves are going to be MIT when I upload them.
(2.46 KiB) Downloaded 210 times
User avatar
Site Admin
Posts: 3205
Joined: 20 Jan 2012, 17:18

Re: NoesisToUnity CodeSmith Template

01 Jun 2015, 22:58

This is great!

If you want, we could host it at our contrib repository. Or if you prefer having your own repository we can branch it at our account.

Thanks for sharing this with the community.

Who is online

Users browsing this forum: No registered users and 1 guest