GithubHelp home page GithubHelp logo

microsoft / unity-xaml-sample Goto Github PK

View Code? Open in Web Editor NEW
21.0 7.0 19.0 306 KB

Unity sample project showing a XAML webview and interaction with a Unity application.

License: MIT License

C# 100.00%

unity-xaml-sample's Introduction

Note: This repo is now archived. It is still available READ ONLY for forking or historical interest.

UnityXAML

Unity sample project showing a XAML webview and interaction with a Unity application

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Following documentation only tells you how to build the project

Requirements

Minimum MSVS 2017 Minimum Unity 2017.3.x

The Unity sample project can be found in the UWPXaml directory. Open Unity 2017 and open the project "On Disk"

UnityXAML

The unity sample project.

UnityXAML\Build

This directory contains some files which will be overlayed with a Unity generated XAML project.

Build Instructions

Open the project in Unity by selecting the root folder of this cloned repo locally from the file->open project menu dialogs.

NOTE: You might get a dialog saying there is a Missing Project ID so you can't use Unity Services. Select "Yes" and continue.

Under the Assets folder in project pane, open the 'MainScene' in _Scenes folder. From Unity, choose File->Build Settings to bring up the Build Settings window. Click Add open scenes to in build section, it should be checked.

Choose Universal Windows Platform as the Platform.

Then under the options

  • Choose "any device" as the Target device.

  • XAML as the UWP Build Type

  • Latest Installed as the SDK

  • Check "Unity C# Projects"

  • Then click Build.

  • Select the folder called 'UWP' and choose this folder.

  • Wait for successful build.

Open the UnityXAML\UWP\UnityXAML.sln in MSVC 2017 or higher.

Select Debug|Release and x64|x32|Any CPU (depending on your VS configuration)

  • Visual Studio 2017 is required to build this project

Once you have opened the solution you can Build->Solution and then run the sample.

NOTE: If you get an option "Attach to unity" you have opened the incorrect SLN file. Ensure you open the UnityXAML\UWP\UnityXAML.sln and not UnityXaml\UnityXAML.sln

The sample is composed of two parts, the XAML portion and the unity portion with a communication class used to pass information between them.

When you start the application you should get a split screen view.

The upper portion is controlled by the mainpage.xaml and contain:

  • Two buttons
  • A text block
  • And a web view

The lower is the unity scene, which contains:

  • One button
  • And a view used to show results.

Pressing "Web Navigate XAML" cause the XAML web view to navigate to a web page. Pressing "Send To Unity (XAML)" will cause the feedback view to show a new message. Pressing "SendDataToXAML (UB)" will cause a message to be sent to the xaml portion showing a count of events from Unity.

Starting Sample Image

After use Sample Image

unity-xaml-sample's People

Contributors

davidshoe avatar microsoftopensource avatar msftgits avatar stammen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

unity-xaml-sample's Issues

Builds and runs, but no Unity Script intellisense

First, thank you for this sample.

I was able to get this to work in my project, it builds and runs without an issue, I can communicate between unity and the app. But I get intellisense errors for the code that communicates with the unity scripts. Your project has no intellisense issues (see screenshots). I built mine in Unity 2018 if that makes any difference.

I used agent ransack to search between the projects and references to ButtonHandlers, I see no difference. Do you some extra reference to Assembly-CSharp to get intellisense to work?

image

Your project:

image

Unity-UWP Mono C# Scripting Deprecated

The C# Mono scripting backend in Unity has been officially deprecated in favor of IL2CPP. Just curious... what is the purpose of this Microsoft repository? I'd hate to see someone adopt this code only to find it is unsupported in six months.

To clarify, I'm not a fan of the change but it is apparently coming. I'm surprised Microsoft is OK with the idea that Unity/UWP integration will be C++ only going forward. I don't know many UWP/C++ developers...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.