Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Edvinas01 committed Jun 9, 2022
0 parents commit 4ca9346
Show file tree
Hide file tree
Showing 91 changed files with 3,848 additions and 0 deletions.
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.0.2] - 2022-05-23
Minor UX updates and bug fixes.

### Added
- More logging which shows that a scene is being currently loaded.
- Methods to access in `loadingCollection` and `loadedCollection` in `ScriptableSceneController`.
- Exposed `IsLoading` property in `ScriptableSceneController`.

### Changed
- Updated Scene Manager Window to support reordering and to provide more info.
- Improved component UX via `AddComponentMenu`.

### Fixed
- Incorrect collection progress being reported when a collection is loading.

## [0.0.1] - 2022-05-21
Initial preview version.

### Added
- `ScriptableScene` - wrapper `ScriptableObject` for `SceneAsset`, which allows referencing scenes without needing to hard-code scene name, path or build index. Click on _Assets > Create > CHARK > Scriptable Scenes > Scriptable Scene_ to create.
- `ScriptableSceneCollection` - container for `ScriptableScene` and is useful to load a set of scenes at once (`SetupScene`, `UIScene`, `GameplayScene`, etc). Click on _Assets > Create > CHARK > Scriptable Scenes > Scriptable Scene Collection_ to create.
- `ScriptableSceneTransition` - `ScriptableObject` that can be used to inject scene transitions.
- `FadeScriptableSceneTransition` - built-in transition which simply fades a canvas in and out (via `FadeCanvas`) during scene loading.
- `FadeCanvas` - built-in component which takes care of actually fading the canvas and subscribing to a `ScriptableSceneTransition`.
- `ScriptableSceneManagerWindow` - Editor Window which can be used to quickly open a set of scene in Edit and also Play mode. Click on _Window > CHARK > Scriptable Scenes > Scriptable Scene Manager_ to open.
7 changes: 7 additions & 0 deletions CHANGELOG.md.meta

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

2 changes: 2 additions & 0 deletions Documentation~/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Documentation
Work in progress :(
8 changes: 8 additions & 0 deletions Editor.meta

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

18 changes: 18 additions & 0 deletions Editor/CHARK.ScriptableScenes.Editor.asmdef
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "CHARK.ScriptableScenes.Editor",
"rootNamespace": "CHARK.ScriptableScenes",
"references": [
"GUID:7cfa357a9d1c66644b9ddbad9d55c0a3"
],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}
7 changes: 7 additions & 0 deletions Editor/CHARK.ScriptableScenes.Editor.asmdef.meta

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

3 changes: 3 additions & 0 deletions Editor/PropertyDrawers.meta

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

23 changes: 23 additions & 0 deletions Editor/PropertyDrawers/ReadOnlyPropertyDrawer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using CHARK.ScriptableScenes.PropertyAttributes;
using UnityEditor;
using UnityEngine;

namespace CHARK.ScriptableScenes.Editor.PropertyDrawers
{
[CustomPropertyDrawer(typeof(ReadOnlyAttribute))]
internal class ReadOnlyPropertyDrawer : PropertyDrawer
{
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
var isEnabled = GUI.enabled;
GUI.enabled = false;
EditorGUI.PropertyField(position, property, label, true);
GUI.enabled = isEnabled;
}

public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
{
return EditorGUI.GetPropertyHeight(property, label, true);
}
}
}
3 changes: 3 additions & 0 deletions Editor/PropertyDrawers/ReadOnlyPropertyDrawer.cs.meta

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

87 changes: 87 additions & 0 deletions Editor/SceneReferenceCollectionEditor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
using System.Linq;
using CHARK.ScriptableScenes.Editor.Utilities;
using UnityEditor;
using UnityEngine;

namespace CHARK.ScriptableScenes.Editor
{
/// <summary>
/// Custom inspector for <see cref="ScriptableSceneCollection"/>, used to draw debug buttons.
/// </summary>
[CanEditMultipleObjects]
[CustomEditor(typeof(BaseScriptableSceneCollection), true)]
internal class SceneReferenceCollectionEditor : UnityEditor.Editor
{
#region Private Fields

private BaseScriptableSceneCollection sceneCollection;

#endregion

#region Unity Lifecycle

private void OnEnable()
{
sceneCollection = (BaseScriptableSceneCollection) target;
}

public override void OnInspectorGUI()
{
base.OnInspectorGUI();

EditorGUILayout.Space();

ScriptableSceneGUI.LabelField("Controls", EditorStyles.boldLabel);
DrawControls(sceneCollection);
}

#endregion

#region Private Methods

private static void DrawControls(BaseScriptableSceneCollection collection)
{
var isAddedScenes = collection.Scenes.Any();
var isEnabled = GUI.enabled;

EditorGUILayout.BeginHorizontal();

GUI.enabled = isEnabled && isAddedScenes && Application.isPlaying == false;
DrawOpenButton(collection);
DrawPlayButton(collection);

GUI.enabled = isEnabled && isAddedScenes && Application.isPlaying;
DrawLoadButton(collection);

EditorGUILayout.EndHorizontal();

GUI.enabled = isEnabled;
}

private static void DrawOpenButton(BaseScriptableSceneCollection collection)
{
if (ScriptableSceneGUI.Button("Open"))
{
collection.Open();
}
}

private static void DrawPlayButton(BaseScriptableSceneCollection collection)
{
if (ScriptableSceneGUI.Button("Play"))
{
collection.Play();
}
}

private static void DrawLoadButton(BaseScriptableSceneCollection collection)
{
if (ScriptableSceneGUI.Button("Load"))
{
collection.Load();
}
}

#endregion
}
}
3 changes: 3 additions & 0 deletions Editor/SceneReferenceCollectionEditor.cs.meta

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

Loading

0 comments on commit 4ca9346

Please sign in to comment.