Skip to content
This repository has been archived by the owner on Oct 18, 2021. It is now read-only.

Commit

Permalink
Fixing error with Multiplayer Prefab editor script
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamy4000 committed Mar 25, 2020
1 parent 1265031 commit 58f9006
Showing 1 changed file with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,16 @@ private void OnGUI()
[MenuItem("GameObject/VRDF/Multiplayer/Connection Scene/Connection Manager", priority = 0)]
static void InstantiateConnectionManager(MenuCommand menuCommand)
{
var connectionManager = FindObjectOfType<VRDFConnectionManager>();
if (connectionManager != null)
{
VRDF_Components.DebugVRDFMessage("A VRDFConnectionManager script is already in your scene, no need for a second one !", true);
Selection.activeObject = connectionManager;
return;
}

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

// Ensure it gets reparented if this was a context click (otherwise does nothing)
GameObjectUtility.SetParentAndAlign(newMultiObject, menuCommand.context as GameObject);
Expand All @@ -52,6 +60,14 @@ static void InstantiateConnectionManager(MenuCommand menuCommand)
[MenuItem("GameObject/VRDF/Multiplayer/In Room/Game Manager", priority = 0)]
static void InstantiateGameManager(MenuCommand menuCommand)
{
var connectionManager = FindObjectOfType<VRDFMultiplayerGameManager>();
if (connectionManager != null)
{
VRDF_Components.DebugVRDFMessage("A VRDFMultiplayerGameManager script is already in your scene, no need for a second one !", true);
Selection.activeObject = connectionManager;
return;
}

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

Expand Down

0 comments on commit 58f9006

Please sign in to comment.