Skip to content

Commit

Permalink
Release to download the repo from GitHub URL (#110)
Browse files Browse the repository at this point in the history
* feat(package)!: the repo is now a unity package (#106)

* move every files in correct folder

* added & rename asmdef

* fix readme

* Update package.json

* fix: assembly definition

* feat!: change the folders architecture

* Create .gitignore

* feat: update the readme to explain how to install

* fix: remove deeplink WIP

* fix(versionumber): the updateversionfrompackagejson function should not use a static path (#103)

* change to a dynamic path

it now use a dynamic path based on the assembly definition

* fix: because the folder structure have changed

* chore: upgrade version

---------

Co-authored-by: Morgan - 6 Freedom <[email protected]>
  • Loading branch information
qvaleroo and Morgan-6Freedom authored Jan 26, 2024
1 parent 3ef53a2 commit 8631310
Show file tree
Hide file tree
Showing 54 changed files with 490 additions and 329 deletions.
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
".": "0.3.0",
".": "0.4.0",
"extra-files": [
{
"type": "json",
Expand Down
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
![Untitled design](resources/social-header.png)
![Header](resources/social-header.png)

# Scenario Unity Plugin

Expand All @@ -16,6 +16,15 @@ With an open dialogue and shared passion for innovation, we look forward to the

Learn more about Scenario on our [website](https://scenario.com/).

## Quick Install

To import the package in Unity,
1. Open the package manager
2. Click [+]
3. Click "Add package from Git URL"
4. Copy past this link `https://github.com/scenario-labs/Scenario-Unity.git?path=/package`
5. Click "Add"

## License

Review the [license](LICENSE) for this project.
10 changes: 0 additions & 10 deletions Scenario/package.json

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"dependencies": {
"release-please": "^15.13.0"
},
"version": "0.3.0"
"version": "0.4.0"
}
97 changes: 97 additions & 0 deletions package/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# This .gitignore file should be placed at the root of your Unity project directory
#
# Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore
#
/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
/[Ll]ogs/
/[Uu]ser[Ss]ettings/
/.idea/
/Documentation/obj/.cache/
xdoc/
/_site/

# Unity Recorder
/[Rr]ecordings/

# MemoryCaptures can get excessive in size.
# They also could contain extremely sensitive data
/[Mm]emoryCaptures/

# Asset meta data should only be ignored when the corresponding asset is also ignored
!/[Aa]ssets/**/*.meta

# Uncomment this line if you wish to ignore the asset store tools plugin
# /[Aa]ssets/AssetStoreTools*

# Autogenerated Jetbrains Rider plugin
/[Aa]ssets/Plugins/Editor/JetBrains*

# Visual Studio cache directory
.vs/
# Visual Studio Code cache directory
.vscode/

# Visual Studio cache directory
.vsconfig

# Gradle cache directory
.gradle/

# MacOS files
.DS_Store

# Autogenerated VS/MD/Consulo solution and project files
ExportedObj/
.consulo/
*.csproj
*.unityproj
*.sln
*.suo
*.tmp
*.user
*.userprefs
*.pidb
*.booproj
*.svd
*.pdb
*.mdb
*.opendb
*.VC.db

# Unity3D generated meta files
*.pidb.meta
*.pdb.meta
*.mdb.meta

# Unity3D generated file on crash reports
sysinfo.txt

# Builds
*.apk
*.aab
*.unitypackage
*.unitypackage.meta

# Crashlytics generated file
crashlytics-build.properties

# Packed Addressables
/[Aa]ssets/[Aa]ddressable[Aa]ssets[Dd]ata/*/*.bin*

# Temporary auto-generated Android Assets
/[Aa]ssets/[Ss]treamingAssets/aa.meta
/[Aa]ssets/[Ss]treamingAssets/aa/*

# ignore hidden ARCore files
/[Aa]ssets/[Ss]treamingAssets/HiddenARCore*

#UWP certificate
*.pfx
*.pfx.meta

#ARFoundationRemote
/ARFoundationRemoteCompanionApp
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[InternetShortcut]
URL=https://help.scenario.com/workflow-tutorials#unity-plugin
IDList=
HotKey=0
IconFile=C:\Users\fangh\AppData\Local\Mozilla\Firefox\Profiles\3v5d162j.default-release\shortcutCache\szF4o2i34bUZPRW73S4a3w==.ico
IconIndex=0
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.Collections.Generic;
using System.Linq;
using System.Linq;
using System.Threading.Tasks;
using Newtonsoft.Json;
using UnityEditor;
Expand Down Expand Up @@ -198,16 +198,16 @@ private static async Task FetchAllPublicModels()
if (response is null) { return; }

var modelsResponse = JsonConvert.DeserializeObject<ModelsResponse>(response);
if (modelsResponse is null) { return; }

foreach (var model in modelsResponse.models)
{
if (modelsPublic.Contains(model))
{
continue;
}

modelsPublic.Add(model);
if (modelsResponse is null) { return; }

foreach (var model in modelsResponse.models)
{
if (modelsPublic.Contains(model))
{
continue;
}

modelsPublic.Add(model);
}

//* modelsPublic.AddRange(modelsResponse.models);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
using UnityEditor;
using UnityEngine;
using System.IO;
using System.Linq;

namespace Scenario
{
public class PluginSettings : EditorWindow
{
private static string assemblyDefinitionFileName = "com.scenarioinc.scenario.editor";
private string apiKey;
private string secretKey;
private string saveFolder;
Expand All @@ -18,7 +20,7 @@ public class PluginSettings : EditorWindow
private readonly string[] imageFormats = { "JPEG", "PNG" };
private readonly string[] imageFormatExtensions = { "jpeg", "png" };

private static string vnumber = "";
private static string vnumber => GetVersionFromPackageJson();
private static string version => $"Scenario Beta Version {vnumber}";

[System.Serializable]
Expand All @@ -27,14 +29,35 @@ private class PackageInfo
public string version;
}

[MenuItem("Scenario/Update Version")]
public static void UpdateVersionFromPackageJson()
/// <summary>
/// Get the correct version number from the package JSON
/// </summary>
/// <returns>The version of the plugin, as a string</returns>
private static string GetVersionFromPackageJson()
{
string packageJsonPath = "Assets/Scenario/package.json";
string packageJsonContent = File.ReadAllText(packageJsonPath);
vnumber = JsonUtility.FromJson<PackageInfo>(packageJsonContent).version;
//Find the assembly Definition which should be at package/Editor/ folder because it's a unique file.
string[] guids = AssetDatabase.FindAssets($"{assemblyDefinitionFileName} t:assemblydefinitionasset");

if (guids.Length > 1)
{
Debug.LogError($"it seems that you have multiple file '{assemblyDefinitionFileName}.asmdef'. Please delete one");
return "0";
}

EditorWindow.GetWindow<PluginSettings>().Repaint();
if (guids.Length == 0)
{
Debug.LogError($"It seems that you don't have the file '{assemblyDefinitionFileName}.asmdef'. Please redownload the plugin from the asset store.");
return "0";
}

//find the folder of that file
string folderPath = AssetDatabase.GUIDToAssetPath(guids[0]);
folderPath = folderPath.Remove(folderPath.IndexOf($"Editor/{assemblyDefinitionFileName}.asmdef"));

//find the package.json inside this folder
string packageJsonPath = $"{folderPath}/package.json";
string packageJsonContent = File.ReadAllText(packageJsonPath);
return JsonUtility.FromJson<PackageInfo>(packageJsonContent).version;
}

public static string EncodedAuth
Expand Down Expand Up @@ -62,15 +85,15 @@ public static void ShowWindow()

private void OnEnable()
{
UpdateVersionFromPackageJson();
GetVersionFromPackageJson();
LoadSettings();
}

private void OnGUI()
{
Color backgroundColor = new Color32(18, 18, 18, 255);
EditorGUI.DrawRect(new Rect(0, 0, Screen.width, Screen.height), backgroundColor);

GUILayout.Space(10);

apiKey = EditorGUILayout.TextField("API Key", apiKey);
Expand Down
File renamed without changes.
Loading

0 comments on commit 8631310

Please sign in to comment.