Skip to content

Commit

Permalink
Merge pull request #18 from bgr/PackageManager
Browse files Browse the repository at this point in the history
Reorganized files for use with Unity Package Manager
  • Loading branch information
marijnz authored May 19, 2020
2 parents d076c08 + 419b101 commit 097ae87
Show file tree
Hide file tree
Showing 42 changed files with 77 additions and 1,567 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 14 additions & 0 deletions Editor/ToolbarExtender.Editor.asmdef
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "ToolbarExtender.Editor",
"references": [],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": []
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using UnityEditor;
using UnityEngine.SceneManagement;
using UnityEditor.SceneManagement;
using UnityEngine;

Expand Down Expand Up @@ -34,12 +35,12 @@ static void OnToolbarGUI()

if(GUILayout.Button(new GUIContent("1", "Start Scene 1"), ToolbarStyles.commandButtonStyle))
{
SceneHelper.StartScene("Assets/ToolbarExtender/Example/Scenes/Scene1.unity");
SceneHelper.StartScene("ToolbarExtenderExampleScene1");
}

if(GUILayout.Button(new GUIContent("2", "Start Scene 2"), ToolbarStyles.commandButtonStyle))
{
SceneHelper.StartScene("Assets/ToolbarExtender/Example/Scenes/Scene2.unity");
SceneHelper.StartScene("ToolbarExtenderExampleScene2");
}
}
}
Expand All @@ -48,14 +49,14 @@ static class SceneHelper
{
static string sceneToOpen;

public static void StartScene(string scene)
public static void StartScene(string sceneName)
{
if(EditorApplication.isPlaying)
{
EditorApplication.isPlaying = false;
}

sceneToOpen = scene;
sceneToOpen = sceneName;
EditorApplication.update += OnUpdate;
}

Expand All @@ -72,8 +73,19 @@ static void OnUpdate()

if(EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo())
{
EditorSceneManager.OpenScene(sceneToOpen);
EditorApplication.isPlaying = true;
// need to get scene via search because the path to the scene
// file contains the package version so it'll change over time
string[] guids = AssetDatabase.FindAssets("t:scene " + sceneToOpen, null);
if (guids.Length == 0)
{
Debug.LogWarning("Couldn't find scene file");
}
else
{
string scenePath = AssetDatabase.GUIDToAssetPath(guids[0]);
EditorSceneManager.OpenScene(scenePath);
EditorApplication.isPlaying = true;
}
}
sceneToOpen = null;
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 1 addition & 2 deletions Assets/ToolbarExtender.meta → LICENSE.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 0 additions & 17 deletions ProjectSettings/AudioManager.asset

This file was deleted.

6 changes: 0 additions & 6 deletions ProjectSettings/ClusterInputManager.asset

This file was deleted.

29 changes: 0 additions & 29 deletions ProjectSettings/DynamicsManager.asset

This file was deleted.

11 changes: 0 additions & 11 deletions ProjectSettings/EditorBuildSettings.asset

This file was deleted.

21 changes: 0 additions & 21 deletions ProjectSettings/EditorSettings.asset

This file was deleted.

61 changes: 0 additions & 61 deletions ProjectSettings/GraphicsSettings.asset

This file was deleted.

Loading

0 comments on commit 097ae87

Please sign in to comment.