Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/SideQuestVR/BanterSDK into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
shane committed Nov 2, 2024
2 parents a5574c7 + f56bcba commit 7adf43c
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 37 deletions.
2 changes: 1 addition & 1 deletion Editor/InitialiseOnLoad.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public class InitialiseOnLoad
[InitializeOnLoadMethod()]
static void Go()
{
// SetupLayersAndTags();
SetupLayersAndTags();
CreateWebRoot();
}

Expand Down
50 changes: 20 additions & 30 deletions Editor/Scripts/VisualScripting/VsNodeGeneration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,54 +24,45 @@ public static class VsNodeGeneration
private const string SETTINGS_ASSET_PATH = "ProjectSettings/VisualScriptingSettings.asset";
private const string GENERATED_VS_NODES_VERSION_PREFS_KEY = "Banter_GeneratedVSNodesVersion";

// static NodeGeneration()
// {
// if (PlayerPrefs.GetString(GENERATED_VS_NODES_VERSION_PREFS_KEY) != PackageManagerUtility.currentVersion)
// {
// EditorApplication.update += CheckForNodeRegen;
// }
// }

#if !BANTER_EDITOR
[InitializeOnLoadMethod]
private static void OnScriptsReloaded()
{
if (PlayerPrefs.GetString(GENERATED_VS_NODES_VERSION_PREFS_KEY) != PackageManagerUtility.currentVersion)
if (EditorPrefs.GetString(GENERATED_VS_NODES_VERSION_PREFS_KEY) != PackageManagerUtility.currentVersion)
{
VSUsageUtility.isVisualScriptingUsed = true;
string DialogMessage = "Banter SDK has been updated and requires a Visual Scripting to be regenerated. This may take a few moments.";
if (!Application.isBatchMode)
UnityEditor.EditorUtility.DisplayDialog("Banter SDK Updated", DialogMessage, "OK");
SetVSTypesAndAssemblies();
}
}
#endif

// private static void CheckForNodeRegen()
// {
// //in order to do a proper unit rebuild, we need to wait until we know VS has been initialized.
// //waiting until a VS window is opened is the best way I have found to do this
// if (EditorWindow.HasOpenInstances<GraphWindow>())
// {
// EditorApplication.update -= CheckForNodeRegen;
// UnityEditor.EditorUtility.DisplayDialog("Banter Scripting Initialization", "Hold tight while we make sure your visual scripting settings are just right", "OK");

// SetVSTypesAndAssemblies();
// }
// }

/// <summary>
/// We need to set the supported types and assemblies in ProjectSettings/VisualScripting
/// Ludiq/Unity really does not want us to edit this... so we have to directly edit the json of the file >:(
/// </summary>
public static void SetVSTypesAndAssemblies()
{
// Initializes internal data structures and editor logic for Visual Scripting.
VSUsageUtility.isVisualScriptingUsed = true;
if(!VSUsageUtility.isVisualScriptingUsed)
VSUsageUtility.isVisualScriptingUsed = true;

string DialogMessage = string.Empty;

if (!File.Exists(SETTINGS_ASSET_PATH))
{
const string MESSAGE = "Visual Scripting is not initialized. Please navigate to the Visual Scripting settings in the Unity project settings to initialize";
DialogMessage = "Visual Scripting is not initialized. Please navigate to the Visual Scripting settings in the Unity project settings to initialize.\n" +
"Then, re-run 'Configure Visual Scripting' in the Banter Bundle Builder's Tools menu.";
if (!Application.isBatchMode)
UnityEditor.EditorUtility.DisplayDialog("Visual Scripting Settings Not Found", MESSAGE, "OK");
throw new System.Exception(MESSAGE);
UnityEditor.EditorUtility.DisplayDialog("Visual Scripting Settings Not Found", DialogMessage, "OK");
Debug.LogError(DialogMessage);
return;
}

if (!Application.isBatchMode && !EditorPrefs.HasKey(GENERATED_VS_NODES_VERSION_PREFS_KEY))
{
DialogMessage = "Initialising Banter Visual Scripting support. This may take a few moments.";
EditorUtility.DisplayDialog("Banter Scripting Initialization", DialogMessage, "OK");
}

// There's an embedded JSON in this asset file. Manually replace the assembly and type arrays.
Expand All @@ -91,8 +82,7 @@ public static void SetVSTypesAndAssemblies()

UnitBase.Rebuild();

PlayerPrefs.SetString(GENERATED_VS_NODES_VERSION_PREFS_KEY, PackageManagerUtility.currentVersion);
PlayerPrefs.Save();
EditorPrefs.SetString(GENERATED_VS_NODES_VERSION_PREFS_KEY, PackageManagerUtility.currentVersion);
}

private static string SetJSONArrayValueHelper(this string target, string arrayContainerName, IEnumerable<string> arrayContents)
Expand Down
9 changes: 6 additions & 3 deletions Runtime/Scripts/Utils/LoadingBarManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,13 @@ public void UpdateCancelText(bool force = false, bool wasKicked = false)
// }
public Transform feetTransform;
public void Preload()
{
if(feetTransform) {
{
if (feetTransform)
{
transform.position = feetTransform.position;
}else{
}
else
{
var pos = Camera.main.transform.position;
pos.y -= 1.55f;
transform.position = pos;
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "com.sidequest.banter",
"version": "2.1.0",
"version": "2.2.0",
"displayName": "Banter SDK",
"description": "This Module contains the Banter SDK used for building spaces in the bantaverse.",
"unity": "2021.3",
"unityRelease": "8f1",
"unity": "2022.3",
"unityRelease": "39f1",
"hideInEditor": false,
"documentationUrl": "https://bantervr.com/documentation",
"changelogUrl": "https://bantervr.com/sdk-changelog",
Expand Down

0 comments on commit 7adf43c

Please sign in to comment.