Jump to content

.NET Integration Sample


photo

Recommended Posts

Hello, ladies and gentlemen! Good news for every human being living in a managed world.

 

Description

 

A simple wrapper (source code included) which shows how to integrate Unigine with .NET and create apps (both WinForms and WPF). You have to have Unigine SDK if you want to use this sample.

 

Build Instructions
  1. Extract contents of dot_net_sample.zip to <SDK> directory. Final path should be: <SDK>/source/samples/App/DotNet1.
  2. Make sure that $(UNIGINE_DIR) system variable set to Unigine 2.0 Alpha preview installation directory.
  3. Open Unigine.NET.sln in VS2012/VS2013;
  4. Select build configuration (Debug/Debug Double/Release/Release Double) and platform (x86/x64) according to your needs;
  5. Build Solution (F7);
  6. Copy <SDK>/source/samples/App/DotNet/unigine.cfg inside <built solution dir>/bin folder;
  7. Run built applications (AppWinForms.exe or AppWPF.exe);
  8. Have fun!

Note: if you want to use float binaries from the sim sdk, you have to copy them inside <sdk_root>/lib folder in order to compile sample properly.

 

You can find this sample in the attachments. Feel free to ask any questions!

dot_net_sample.zip

  • Like 1
Link to comment

Great thanks! I'll check it out tonight. 

 

What's your plan with this integration at the moment? Do you plan to officially support it and start building a framework around it?

Link to comment

Couple of things:

 

  1. I followed your instructions - It compiled fine and ran fine. When I hit the Load button it crashes. I tried with all 4 build configuration options. I'm using the Sim 2.0 Alpha SDK.
  2. Maybe I'm mistaken, but this is just a C#-based bootstrap loader? All game/engine code must still be done in C++? I had hoped this was the beginning of moving to a more modern managed scripting framework.
Link to comment

scott.richmond
 

I followed your instructions - It compiled fine and ran fine. When I hit the Load button it crashes. I tried with all 4 build configuration options. I'm using the Sim 2.0 Alpha SDK.


Sorry, can't reproduce. If you are using Sim SDK you need to build Double configurations. For example, Debug Double x64. After that you should copy unigine.cfg into DotNet/Debug Double/x64/bin directory. Could you please provide more information about this issue:

  • Is AppWPF sample is working (only AppWinForms not working)?
  • Is there near AppWinForms.exe and AppWPF.exe engine log file (log.html)? If there is log file could you please attach it in your response.
  • If you copy <SDK>/lib/Unigine_x64d,dll into DotNet/Debug Double/x64/bin directly and launch samples again will they crash?

Maybe I'm mistaken, but this is just a C#-based bootstrap loader? All game/engine code must still be done in C++? I had hoped this was the beginning of moving to a more modern managed scripting framework.

 

Yes, currently it is C#-based loader.

 

Thanks!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment

Hey Silent,

 

Thanks for replying. However I had mistaken this feature to be the beginnings of a C#-based framework to replace your depreciated UnigineScript. I'm not interested in a C#-based loader, so I'll stop here.

 

Thanks anyway!

Link to comment
  • 2 weeks later...

There is some progress on C# API: it will have the same level of access as C++ API.

 

That's great news! When do you expect to deliver the first implementation?

Link to comment
  • 6 months later...

Hi,

 

I'm trying to use the sample with the UNIGINE 2 Game SDK source but there are headers and things that seem to have moved all over the place so I'm having trouble compiling this.

 

Is there an update for the sample or any other examples of setting up a .net project available?

 

Cheers,

Simon

Link to comment

Hi Simon,

 

I'm afraid this sample is deprecated, because we added recently C# API and few examples of intergration: https://developer.unigine.com/en/docs/1.0/csharp_api/usage/unigine_app/

They are available for download through the new SDK Browser (if you are using latest beta2 SDK).

 

Thanks!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment
  • 1 month later...

One additional question here as I did not find the answer on your site (I apologize if I overlooked it).

 

So given the current state of the C# API, would you think there are any disadvantages of using C# instead of C++ API?

 

Or would you say the C# API is very much production-ready in all scenarios the C++ API can be used in?

Link to comment
  • 3 weeks later...

Hang on - just to get things straight here.  As of now we can use c# as an alternative to uniginescript correct?  This means we basically just upgrade any deprecated c++ code to 2.0 and then we can bind any backend code (c++) with frontend c# AND/OR uniginescript right? 

 

If not - is this in the roadmap?  and if so when is it planned for?   

 

I'd really like this cleared up as I've informed my team that we no longer have to use uniginescript and we are making plans to switch to c# (dynamic breakpoints being one of the main reasons).

Link to comment

Also, I'm still struggling to get a c# sample working within a WPF application using xaml.  I'd like to bind some basic xaml UI controls to perform actions in Unigine.

 

If you had a simple walkthrough on how to set this up I think you'd make a lot of people happy!

Link to comment

Hi Simon,

 

 As of now we can use c# as an alternative to uniginescript correct?

Yes, but there not all the UnigineScript functions available in C# and C++ API. We are continue to extending these APIs and we hope to export all the UnigineScript function to the C++ / C# API by the end of this year.

 

This means we basically just upgrade any deprecated c++ code to 2.0 and then we can bind any backend code (c++) with frontend c# AND/OR uniginescript right?

Yes, I think it is possible even right now.

 

Also, I'm still struggling to get a c# sample working within a WPF application using xaml.  I'd like to bind some basic xaml UI controls to perform actions in Unigine.

Could you please provide us a sample with build instructions where you are getting issues? We would try to help you and maybe if everything will work fine add a new sample to the C# section with WPF and xaml.

 

Thanks!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment

Ok - great that you're working towards a complete c# api.

 

 

As far as the WPF goes - 2 problems:

 

1.  How do I embed the unigine 3d window into a xaml application?  Should I use a xaml control/binding to do this?

2.  How do I map xaml control events (button press etc) back to unigine?

 

These are the two biggest problems - not even at the compile error stage yet.  So, if you make some suggestions on how to do this I'd me more than happy to implement it and give you the code!

 

Cheers,

Simon

Link to comment

Ok - so as far as 1. goes it looks like using WinformsHost in the xaml file to host the unigine window might be an option right?

Link to comment
×
×
  • Create New...