Second commit
This commit is contained in:
commit
36840f3ad4
999 files changed
+61364
No files matched your search
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// This file is part of the Tremble package by Tiny Goose.
|
||||
// Copyright (c) 2024-2026 TinyGoose Ltd., All Rights Reserved.
|
||||
//
|
||||
|
||||
using UnityEditor;
|
||||
|
||||
namespace TinyGoose.Tremble.Editor
|
||||
{
|
||||
[ManualPage("Basics/Create Map", "Create your first map")]
|
||||
public class CreateMapPage : ManualPageBase
|
||||
{
|
||||
protected override void OnGUI()
|
||||
{
|
||||
Number(
|
||||
"In the project window, right-click and select 'Create' > 'Tremble Map'. Give your map a name,",
|
||||
"then hit enter."
|
||||
);
|
||||
|
||||
ActionBar_SingleAction("Create new map called 'Test' in Assets", () =>
|
||||
{
|
||||
MapFileAsset mapFileAsset = MapFileAsset.CreateInstance<MapFileAsset>();
|
||||
|
||||
AssetDatabase.CreateAsset(mapFileAsset, "Assets/MAP_Test.asset");
|
||||
AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate);
|
||||
});
|
||||
|
||||
Number(
|
||||
"TrenchBroom will open the new map for you to edit, with your project's materials",
|
||||
"available to use."
|
||||
);
|
||||
|
||||
Number(
|
||||
"Since you have not yet marked any Unity scripts as entities, you will not see any",
|
||||
"in TrenchBroom yet and can only create worldspawn brushes for now. See",
|
||||
"the 'Entities' section to get started!"
|
||||
);
|
||||
ActionBar_SingleAction("Read about Entities", () => GoToPage(typeof(EntitiesOverviewPage)));
|
||||
|
||||
Number("When you're ready, save the map and return to Unity.");
|
||||
Number("You should see a prompt - click 'Yep!'. Your new map is added to your current Unity scene.");
|
||||
|
||||
Image("T_Manual_CreateMap", width: 300f);
|
||||
|
||||
Callout("If the prompt doesn't show, or you want to add it to another scene, manually drag your",
|
||||
"new map file into the scene.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 43b737fff371496b807982db7eb1e9ad
|
||||
timeCreated: 1723137369
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 277805
|
||||
packageName: Tremble - Map Importer
|
||||
packageVersion: 1.11.1
|
||||
assetPath: Assets/Tremble/Editor/Manual/Pages/Basics/CreateMapPage.cs
|
||||
uploadId: 939664
|
||||
@@ -0,0 +1,105 @@
|
||||
//
|
||||
// This file is part of the Tremble package by Tiny Goose.
|
||||
// Copyright (c) 2024-2026 TinyGoose Ltd., All Rights Reserved.
|
||||
//
|
||||
|
||||
using UnityEditor;
|
||||
|
||||
namespace TinyGoose.Tremble.Editor
|
||||
{
|
||||
[ManualPage("Basics/Live Update", "Using Live Update")]
|
||||
public class LiveUpdatePage : ManualPageBase
|
||||
{
|
||||
private static readonly string[] REFRESH_MODES = { "Disabled", "Enabled", "Enabled Outside Playmode" };
|
||||
|
||||
protected override void OnGUI()
|
||||
{
|
||||
Experimental();
|
||||
|
||||
int autoRefreshMode = EditorPrefs.GetInt("kAutoRefreshMode");
|
||||
if (autoRefreshMode != 1)
|
||||
{
|
||||
Callout($"Your project uses Auto Refresh Mode: {REFRESH_MODES[autoRefreshMode]}. This",
|
||||
$"will mean that Live Update will not function. Change it to {REFRESH_MODES[1]} to",
|
||||
"use Live Update!");
|
||||
ActionBar_SingleAction("Enable Auto Refresh during playmode", () => EditorPrefs.SetInt("kAutoRefreshMode", 1));
|
||||
}
|
||||
|
||||
Text(
|
||||
"Tremble supports Live Editing - the act of editing a map while in Unity Editor's playmode.",
|
||||
"All you need to do is save changes to your map file while the game is running in editor playmode.",
|
||||
"The map is imported as normal, and then Tremble will try to 'reinstance' the map in memory."
|
||||
);
|
||||
|
||||
Foldout("Wait, what's reinstancing?", () =>
|
||||
{
|
||||
Text("What this means is, Tremble will:");
|
||||
|
||||
Bullet("Destroy all worldspawn geometry, and copy the new geometry from the new map");
|
||||
Bullet("For entities:");
|
||||
Indent(() =>
|
||||
{
|
||||
Bullet(
|
||||
"If an entity is not present in the running game, spawn it (note: this may mean, for example,",
|
||||
"that if you kill an enemy and then save the map, the enemy may get respawned)."
|
||||
);
|
||||
Bullet(
|
||||
"If an entity is present in the running game, but not in the map, it is removed",
|
||||
"(this does not work in all cases!)"
|
||||
);
|
||||
Bullet(
|
||||
"If any entity properties have changed, and are simple properties",
|
||||
"(floats, ints, Vector3s), these are updated."
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
H1("Handling Live Update logic");
|
||||
{
|
||||
H2("General Usage");
|
||||
|
||||
Text(
|
||||
"If you need to re-run some logic in an entity after it is LiveUpdated, you can implement",
|
||||
$"the {nameof(IOnLiveUpdate)} interface, and override the OnLiveUpdate() method to perform any custom",
|
||||
"logic."
|
||||
);
|
||||
|
||||
Text(
|
||||
"For example, finding the list of entities of a certain type (as these may have",
|
||||
"changed as a result of the map changing)."
|
||||
);
|
||||
|
||||
Image("T_Manual_LiveUpdate1");
|
||||
|
||||
H2("Simpler Usage");
|
||||
|
||||
Text(
|
||||
"If this logic is identical to what would usually happen in your Start or Awake methods,",
|
||||
$"you can instead implement the {nameof(IOnLiveUpdate_Simple)} interface."
|
||||
);
|
||||
|
||||
Text(
|
||||
"This will signal to Tremble that after a LiveUpdate occurs, it should call OnDestroy,",
|
||||
"followed by Awake and Start (in that order) on your entity. That way, as long as your",
|
||||
"Awake/Start methods set your entity up, and OnDestroy removes any state, it will 'just work'!"
|
||||
);
|
||||
|
||||
Image("T_Manual_LiveUpdate2");
|
||||
}
|
||||
|
||||
H2("Warnings!");
|
||||
{
|
||||
Text(
|
||||
"If LiveUpdate goes wrong or breaks, your game may be left in a broken state.",
|
||||
"To recover from this, you'll need to stop playmode, and start it again."
|
||||
);
|
||||
|
||||
Callout(
|
||||
"Known bug: Sometimes, after LiveUpdate has failed, the map is left in a broken state",
|
||||
"outside of playmode too. This is a rare bug that I've only seen a handful of times.",
|
||||
"Of course, if this occurs, simply re-import your map again after exiting playmode to fix it."
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5da16a3f20f7452f92a7f6ca768bb67b
|
||||
timeCreated: 1723449031
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 277805
|
||||
packageName: Tremble - Map Importer
|
||||
packageVersion: 1.11.1
|
||||
assetPath: Assets/Tremble/Editor/Manual/Pages/Basics/LiveUpdatePage.cs
|
||||
uploadId: 939664
|
||||
@@ -0,0 +1,27 @@
|
||||
//
|
||||
// This file is part of the Tremble package by Tiny Goose.
|
||||
// Copyright (c) 2024-2026 TinyGoose Ltd., All Rights Reserved.
|
||||
//
|
||||
|
||||
namespace TinyGoose.Tremble.Editor
|
||||
{
|
||||
[ManualPage("Basics/Settings", "Tremble's Settings")]
|
||||
public class SettingsPage : ManualPageBase
|
||||
{
|
||||
protected override void OnGUI()
|
||||
{
|
||||
Text(
|
||||
"Tremble's default settings are designed to be suitable for most users, and most games.",
|
||||
"If you're a bit more advanced, or just want to tweak various things - click ''Tools'' > ",
|
||||
"''Tremble'' > ''Open Settings...'' in the Unity menu."
|
||||
);
|
||||
|
||||
Text(
|
||||
"Each tab shows settings for a different aspect of Tremble.",
|
||||
"Help text is provided for each option."
|
||||
);
|
||||
|
||||
ActionBar_SingleAction("Open Settings for me", TrembleEditorAPI.OpenSettings);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 00222940e88a45a3ac88a8fa87192328
|
||||
timeCreated: 1723137185
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 277805
|
||||
packageName: Tremble - Map Importer
|
||||
packageVersion: 1.11.1
|
||||
assetPath: Assets/Tremble/Editor/Manual/Pages/Basics/SettingsPage.cs
|
||||
uploadId: 939664
|
||||
@@ -0,0 +1,71 @@
|
||||
//
|
||||
// This file is part of the Tremble package by Tiny Goose.
|
||||
// Copyright (c) 2024-2026 TinyGoose Ltd., All Rights Reserved.
|
||||
//
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace TinyGoose.Tremble.Editor
|
||||
{
|
||||
[ManualPage("Basics/Sync Toolbar")]
|
||||
public class SyncOverlayPage : ManualPageBase
|
||||
{
|
||||
private bool m_ShowAlreadyHere;
|
||||
|
||||
protected override void OnGUI()
|
||||
{
|
||||
Text(
|
||||
"By default, Tremble adds a toolbar to your scene view to quickly sync settings to",
|
||||
"TrenchBroom, or to (re)import your map."
|
||||
);
|
||||
|
||||
Text(
|
||||
"You can reopen it with \"Tools\" > \"Tremble\" > \"Show Sync Toolbar\" (Unity 2022+)",
|
||||
"if you lose it, or by right-clicking on your scene tab and clicking \"Overlay Menu\"",
|
||||
"(or hitting [`] on your keyboard) and selecting \"Tremble Sync\".");
|
||||
|
||||
#if UNITY_2022_1_OR_NEWER
|
||||
ActionBar_SingleAction("Open the Sync Toolbar for me", () => SceneView.AddOverlayToActiveView(new TrembleSyncOverlay()));
|
||||
#endif
|
||||
|
||||
H1("Toolbar Buttons");
|
||||
Text("The sync toolbar looks like this:");
|
||||
ToolbarButtonDescription("T_TB_Import", "Re-import map(s) in current scene from TrenchBroom");
|
||||
ToolbarButtonDescription("T_TB_Sync", "Sync Unity prefabs and materials to TrenchBroom");
|
||||
ToolbarButtonDescription("T_TB_Config", "Open Tremble's Settings");
|
||||
ToolbarButtonDescription("T_TB_Manual", "Open the Tremble Manual (this!)");
|
||||
|
||||
ActionBar(() =>
|
||||
{
|
||||
Action("Import", TrembleEditorAPI.ReimportCurrentMap);
|
||||
Action("Sync", TrembleEditorAPI.SyncToTrenchBroom);
|
||||
Action("Settings", TrembleEditorAPI.OpenSettings);
|
||||
Action("Manual", () => m_ShowAlreadyHere = true);
|
||||
});
|
||||
|
||||
if (m_ShowAlreadyHere)
|
||||
{
|
||||
Text("You silly! You're already in the manual!");
|
||||
}
|
||||
}
|
||||
|
||||
private void ToolbarButtonDescription(string textureName, string description)
|
||||
{
|
||||
GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
|
||||
{
|
||||
Image(textureName, 30f, centred: false);
|
||||
GUILayout.BeginVertical();
|
||||
{
|
||||
GUILayout.Space(10f * ManualStyles.Scale);
|
||||
GUILayout.Label(description, ManualStyles.Styles.Text);
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
GUILayout.FlexibleSpace();
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
SmallSpace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b7dbe33a0d0446e381e8d0316f066317
|
||||
timeCreated: 1723117770
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 277805
|
||||
packageName: Tremble - Map Importer
|
||||
packageVersion: 1.11.1
|
||||
assetPath: Assets/Tremble/Editor/Manual/Pages/Basics/SyncOverlayPage.cs
|
||||
uploadId: 939664
|
||||
Reference in new issue
Block a user