Feel Physics Backyard

HoloLensの出張授業をする会社で、教材を開発しています

Let Photon Unity Networking DemoBoxes sample work with HoloLens

f:id:weed_7777:20180306182346p:plain

Has anyone tried the Photon Unity Networking plugin? Any luck in getting it to work with HoloLens? If yes then how did you do it?

Just download PUN and try the very first sample... it just works.

  1. Import Photon Unity Networking
  2. Register App Id
  3. File > Build Settings > Scenes In Build
    Uncheck all scenes but "DemoBoxes"
  4. Open scene "DemoBoxes"
  5. Add "Box Colider" Component to all "Scripted Plane" in "Scripted Planes" to catch gaze
  6. Import MRTK
  7. Configure > Apply Mixed Reality Project Settings
  8. Configure > Apply Mixed Reality Scene Settings
  9. Configure > Apply UWP Capablity Settings
    Check "Internet Client"
  10. Add three parts to "OnClickInstantiate.cs" in "Scripted Plane" as below:
using UnityEngine;
using System.Collections;
using HoloToolkit.Unity.InputModule;  // Added 1

public class OnClickInstantiate : MonoBehaviour, IInputClickHandler  // Added 2
{
    public GameObject Prefab;
    public int InstantiateType;
    private string[] InstantiateTypeNames = {"Mine", "Scene"};

    public bool showGui;

    void OnClick()
    {
        if (!PhotonNetwork.inRoom)
        {
            // only use PhotonNetwork.Instantiate while in a room.
            return;
        }

        switch (InstantiateType)
        {
            case 0:
                PhotonNetwork.Instantiate(Prefab.name, InputToEvent.inputHitPos + new Vector3(0, 5f, 0), Quaternion.identity, 0);
                break;
            case 1:
                PhotonNetwork.InstantiateSceneObject(Prefab.name, InputToEvent.inputHitPos + new Vector3(0, 5f, 0), Quaternion.identity, 0, null);
                break;
        }
    }

    void OnGUI()
    {
        if (showGui)
        {
            GUILayout.BeginArea(new Rect(Screen.width - 180, 0, 180, 50));
            InstantiateType = GUILayout.Toolbar(InstantiateType, InstantiateTypeNames);
            GUILayout.EndArea();
        }
    }

    public void OnInputClicked(InputClickedEventData eventData)  // Added 3
    {
        OnClick();
        Debug.Log("Airtapped");
    }
}

Done!

'SpatialInteractionController' does not contain a definition for 'TryGetRenderableModelAsync'

f:id:weed_7777:20180306091234p:plain

Assets\HoloToolkit\Utilities\Scripts\Extensions\InteractionSourceExtensions.cs(113,43): error CS1929: 'SpatialInteractionController' does not contain a definition for 'TryGetRenderableModelAsync' and the best extension method overload 'InteractionSourceExtensions.TryGetRenderableModelAsync(InteractionSource)' requires a receiver of type 'InteractionSource'

Install UWP Windows 10 SDK 10.0.16299.0 by Visual Studio Installer