コード例 #1
0
        static void InstantiateLeftController(MenuCommand menuCommand)
        {
            _infoToAddToWindow = "This prefab let you see the Left controller of the other users.";
            _window            = CreateWindow <MultiplayerPrefabsInstancier>("Left Controller for Remote Players");
            SetWindowSize();

            // Create a custom game object
            GameObject newMultiObject = (GameObject)PrefabUtility.InstantiatePrefab(VRDFPrefabReferencer.GetPrefab("LeftControllerModelMultiplayer"));

            // Ensure it gets reparented if this was a context click (otherwise does nothing)
            GameObjectUtility.SetParentAndAlign(newMultiObject, menuCommand.context as GameObject);

            // Register the creation in the undo system
            Undo.RegisterCreatedObjectUndo(newMultiObject, "Create " + newMultiObject.name);
            Selection.activeObject = newMultiObject;
        }
コード例 #2
0
        static void InstantiateSharedLaserPointer(MenuCommand menuCommand)
        {
            // Create a custom game object
            GameObject newMultiObject = (GameObject)PrefabUtility.InstantiatePrefab(VRDFPrefabReferencer.GetPrefab("LaserPointerMultiplayer"));

            // Ensure it gets reparented if this was a context click (otherwise does nothing)
            GameObjectUtility.SetParentAndAlign(newMultiObject, menuCommand.context as GameObject);

            // Register the creation in the undo system
            Undo.RegisterCreatedObjectUndo(newMultiObject, "Create " + newMultiObject.name);
            Selection.activeObject = newMultiObject;

            _infoToAddToWindow = "This prefab let you see the laser pointer of the remote users. TO use this feature,\n" +
                                 "you need to add a Laser Pointer (Hierarchy>VRDF>Raycast>Add Raycaster with Laser Pointer) for the local user in your scene or SetupVR prefab.";
            _window = CreateWindow <MultiplayerPrefabsInstancier>("Laser for Remote Players");
            SetWindowSize();
        }