[TASK] Initial commit with basic product setup
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
namespace Mapbox.Unity.Utilities.DebugTools
|
||||
{
|
||||
using UnityEngine;
|
||||
|
||||
public class SceneData : ScriptableObject
|
||||
{
|
||||
public string Name;
|
||||
public string ScenePath;
|
||||
public Texture2D Image;
|
||||
public TextAsset Text;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e5d9ef4c9a5f1410ea3cf247b3917654
|
||||
timeCreated: 1512584162
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,59 @@
|
||||
namespace Mapbox.Unity.Utilities.DebugTools
|
||||
{
|
||||
using UnityEngine;
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
#endif
|
||||
public class ScenesList : ScriptableObject
|
||||
{
|
||||
public SceneData[] SceneList;
|
||||
|
||||
//ensure that linked scenes are stored in this object
|
||||
#if UNITY_EDITOR
|
||||
|
||||
public void LinkScenes()
|
||||
{
|
||||
for (int i = 0; i < SceneList.Length; i++)
|
||||
{
|
||||
if (!ThisAssetContainsScene(SceneList[i]))
|
||||
{
|
||||
//duplicate the asset
|
||||
var path = AssetDatabase.GetAssetPath(this);
|
||||
var newScene = ScriptableObject.CreateInstance<SceneData>();
|
||||
newScene.name = SceneList[i].name;
|
||||
newScene.ScenePath = SceneList[i].ScenePath;
|
||||
newScene.Text = SceneList[i].Text;
|
||||
newScene.Image = SceneList[i].Image;
|
||||
|
||||
//assign it to the current scene list
|
||||
AssetDatabase.AddObjectToAsset(newScene, path);
|
||||
SceneList[i] = newScene;
|
||||
|
||||
//save the scenelist
|
||||
EditorUtility.SetDirty(this);
|
||||
AssetDatabase.SaveAssets();
|
||||
|
||||
//TODO: clean up unreferenced sub-assets with Destroy
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool ThisAssetContainsScene(SceneData scene)
|
||||
{
|
||||
var path = AssetDatabase.GetAssetPath(this);
|
||||
Object[] assets = AssetDatabase.LoadAllAssetsAtPath(path);
|
||||
foreach (var asset in assets)
|
||||
{
|
||||
if (asset == scene)
|
||||
{
|
||||
//Debug.Log("Asset " + scene + " is contained in " + path);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c331d4375e95e4050aadbf5ed3492bba
|
||||
timeCreated: 1512102887
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user