├── .gitattributes ├── .gitignore ├── Assets ├── BeastConsole.meta ├── BeastConsole │ ├── Backend.meta │ ├── Backend │ │ ├── AttributeCommand.cs │ │ ├── AttributeCommand.cs.meta │ │ ├── AutocompleteDictionary.cs │ │ ├── AutocompleteDictionary.cs.meta │ │ ├── Command.cs │ │ ├── Command.cs.meta │ │ ├── ConsoleBackend.cs │ │ ├── ConsoleBackend.cs.meta │ │ ├── FieldCommand.cs │ │ ├── FieldCommand.cs.meta │ │ ├── PropertyCommand.cs │ │ ├── PropertyCommand.cs.meta │ │ ├── Trie.cs │ │ ├── Trie.cs.meta │ │ ├── TrieEntry.cs │ │ ├── TrieEntry.cs.meta │ │ ├── Variable.cs │ │ └── Variable.cs.meta │ ├── Console.cs │ ├── Console.cs.meta │ ├── ConsoleCommandAttribute.cs │ ├── ConsoleCommandAttribute.cs.meta │ ├── ConsoleParseAttribute.cs │ ├── ConsoleParseAttribute.cs.meta │ ├── ConsolePrefixes.cs │ ├── ConsolePrefixes.cs.meta │ ├── ConsolePrefixes_USER.cs │ ├── ConsolePrefixes_USER.cs.meta │ ├── ConsoleUtility.cs │ ├── ConsoleUtility.cs.meta │ ├── ConsoleVariableAttribute.cs │ ├── ConsoleVariableAttribute.cs.meta │ ├── Gui.meta │ ├── Gui │ │ ├── ConsoleGui.cs │ │ └── ConsoleGui.cs.meta │ ├── Prefab.meta │ ├── Prefab │ │ ├── Console.prefab │ │ └── Console.prefab.meta │ ├── Resources.meta │ ├── Resources │ │ ├── BeastConsole.meta │ │ └── BeastConsole │ │ │ ├── ConsoleSkin.guiskin │ │ │ ├── ConsoleSkin.guiskin.meta │ │ │ ├── Fonts.meta │ │ │ ├── Fonts │ │ │ ├── DejaVuSansMono-Bold.ttf │ │ │ ├── DejaVuSansMono-Bold.ttf.meta │ │ │ ├── DejaVuSansMono.ttf │ │ │ └── DejaVuSansMono.ttf.meta │ │ │ ├── box.png │ │ │ ├── box.png.meta │ │ │ ├── box_transparent.png │ │ │ ├── box_transparent.png.meta │ │ │ ├── suggestion.png │ │ │ ├── suggestion.png.meta │ │ │ ├── suggestion_active.png │ │ │ ├── suggestion_active.png.meta │ │ │ ├── textfield_focused.png │ │ │ └── textfield_focused.png.meta │ ├── SmartConsoleLicence.txt │ └── SmartConsoleLicence.txt.meta ├── Example.meta └── Example │ ├── AttributeTest.cs │ ├── AttributeTest.cs.meta │ ├── AutoCompleteExmaple.cs │ ├── AutoCompleteExmaple.cs.meta │ ├── Editor.meta │ ├── Editor │ ├── EditorTests.cs │ └── EditorTests.cs.meta │ ├── Example.cs │ ├── Example.cs.meta │ ├── Example.unity │ ├── Example.unity.meta │ ├── ExampleConfigAttribute.cs │ ├── ExampleConfigAttribute.cs.meta │ ├── ExampleConfigManual.cs │ ├── ExampleConfigManual.cs.meta │ ├── MultilineExample.cs │ └── MultilineExample.cs.meta ├── LICENSE.md ├── Packages └── manifest.json └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | *.meta eol=crlf 3 | *.psd filter=lfs diff=lfs merge=lfs -text 4 | *.pdf filter=lfs diff=lfs merge=lfs -text 5 | *.tiff filter=lfs diff=lfs merge=lfs -text 6 | *.jpg filter=lfs diff=lfs merge=lfs -text 7 | *.gif filter=lfs diff=lfs merge=lfs -text 8 | *.mp3 filter=lfs diff=lfs merge=lfs -text 9 | *.png filter=lfs diff=lfs merge=lfs -text 10 | *.obj filter=lfs diff=lfs merge=lfs -text 11 | *.tga filter=lfs diff=lfs merge=lfs -text 12 | *.wav filter=lfs diff=lfs merge=lfs -text 13 | *.mov filter=lfs diff=lfs merge=lfs -text 14 | *.tiff filter=lfs diff=lfs merge=lfs -text 15 | *.tif filter=lfs diff=lfs merge=lfs -text 16 | *.mb filter=lfs diff=lfs merge=lfs -text 17 | *.fbx filter=lfs diff=lfs merge=lfs -text 18 | *.cubemap filter=lfs diff=lfs merge=lfs -text 19 | *.asset filter=lfs diff=lfs merge=lfs -text 20 | *.ma filter=lfs diff=lfs merge=lfs -text 21 | *.sfk filter=lfs diff=lfs merge=lfs -text -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # =============== # 2 | # Unity generated # 3 | # =============== # 4 | [Tt]emp/ 5 | [Oo]bj/ 6 | [Bb]uild 7 | [Bb]uilds 8 | /.vs 9 | vs/ 10 | /[Ll]ibrary/ 11 | /Assets/rVar 12 | /Assets/rVar.meta 13 | sysinfo.txt 14 | ProjectSettings/ 15 | Logs/ 16 | 17 | # ===================================== # 18 | # Visual Studio / MonoDevelop generated # 19 | # ===================================== # 20 | [Ee]xported[Oo]bj/ 21 | *.userprefs 22 | *.csproj 23 | *.pidb 24 | *.suo 25 | *.sln* 26 | *.user 27 | *.unityproj 28 | *.booproj 29 | SyntaxTree.VisualStudio.Unity.Bridge.dll 30 | SyntaxTree.VisualStudio.Unity.Messaging.dll 31 | UnityVS.VersionSpecific.dll 32 | UnityVS/ 33 | UnityVS.meta 34 | 35 | 36 | # ============ # 37 | # OS generated # 38 | # ============ # 39 | .DS_Store* 40 | ._* 41 | .Spotlight-V100 42 | .Trashes 43 | 44 | ehthumbs.db 45 | [Tt]humbs.db 46 | [Tt]humbs.db.meta 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /Assets/BeastConsole.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e9523eac33819b24c93fcd1445a95a8e 3 | folderAsset: yes 4 | timeCreated: 1498846448 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/BeastConsole/Backend.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 990dc15265aa6e44c81daadf9f9c15ae 3 | folderAsset: yes 4 | timeCreated: 1498846766 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/BeastConsole/Backend/AttributeCommand.cs: -------------------------------------------------------------------------------- 1 | namespace BeastConsole.Backend.Internal { 2 | using UnityEngine; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Reflection; 6 | using System.Linq; 7 | 8 | internal class AttributeCommand : Command { 9 | 10 | internal MethodInfo m_methodInfo; 11 | internal ParameterInfo[] m_parameters; 12 | internal Type[] m_paramTypes; 13 | 14 | private object[] m_paramObj; 15 | 16 | public AttributeCommand(string name, string description, ConsoleBackend backend) : base(name, description, backend) { 17 | } 18 | 19 | internal void Initialize(MethodInfo info) { 20 | m_methodInfo = info; 21 | m_methodInfo = info; 22 | m_parameters = info.GetParameters(); 23 | m_paramTypes = m_parameters.Select(x => x.ParameterType).ToArray(); 24 | } 25 | 26 | internal override void Execute(string line) { 27 | var split = line.TrimEnd().Split(' '); 28 | 29 | if (split.Length - 1 < m_parameters.Length) { 30 | BeastConsole.Console.WriteLine("Wrong parameters count"); 31 | return; 32 | } 33 | 34 | if (m_paramObj == null) 35 | m_paramObj = new object[m_paramTypes.Length]; 36 | 37 | for (int i = 0; i < m_paramTypes.Length; i++) { 38 | try { 39 | m_paramObj[i] = Convert.ChangeType(split[i + 1], m_paramTypes[i]); 40 | 41 | } 42 | catch (Exception e) { 43 | BeastConsole.Console.WriteLine("param(" + i + ") -" + e.Message); 44 | 45 | } 46 | if (m_paramObj[i] == null) { 47 | return; 48 | } 49 | } 50 | 51 | var gos = GameObject.FindObjectsOfType(m_methodInfo.DeclaringType); 52 | int count = gos.Length; 53 | for (int i = 0; i < count; i++) { 54 | m_methodInfo.Invoke(gos[i], m_paramObj); 55 | } 56 | } 57 | } 58 | } -------------------------------------------------------------------------------- /Assets/BeastConsole/Backend/AttributeCommand.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 531739e2aba3b7c4fab1eb374499d790 3 | timeCreated: 1499208123 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/BeastConsole/Backend/AutocompleteDictionary.cs: -------------------------------------------------------------------------------- 1 | namespace BeastConsole.Backend.Internal { 2 | 3 | using UnityEngine; 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | internal class AutoCompleteDictionary : SortedDictionary 8 | { 9 | public AutoCompleteDictionary() 10 | : base(new AutoCompleteComparer()) 11 | { 12 | m_comparer = this.Comparer as AutoCompleteComparer; 13 | } 14 | 15 | public T LowerBound(string lookupString) 16 | { 17 | m_comparer.Reset(); 18 | this.ContainsKey(lookupString); 19 | return this[m_comparer.LowerBound]; 20 | } 21 | 22 | public T UpperBound(string lookupString) 23 | { 24 | m_comparer.Reset(); 25 | this.ContainsKey(lookupString); 26 | return this[m_comparer.UpperBound]; 27 | } 28 | 29 | public T AutoCompleteLookup(string lookupString) 30 | { 31 | m_comparer.Reset(); 32 | this.ContainsKey(lookupString); 33 | string key = (m_comparer.UpperBound == null) ? m_comparer.LowerBound : m_comparer.UpperBound; 34 | return this[key]; 35 | } 36 | 37 | private class AutoCompleteComparer : IComparer 38 | { 39 | private string m_lowerBound = null; 40 | private string m_upperBound = null; 41 | public string LowerBound { get { return m_lowerBound; } } 42 | public string UpperBound { get { return m_upperBound; } } 43 | public int Compare(string x, string y) 44 | { 45 | int comparison = Comparer.Default.Compare(x, y); 46 | if (comparison >= 0) 47 | { 48 | m_lowerBound = y; 49 | } 50 | if (comparison <= 0) 51 | { 52 | m_upperBound = y; 53 | } 54 | return comparison; 55 | } 56 | public void Reset() 57 | { 58 | m_lowerBound = null; 59 | m_upperBound = null; 60 | } 61 | } 62 | private AutoCompleteComparer m_comparer; 63 | } 64 | } -------------------------------------------------------------------------------- /Assets/BeastConsole/Backend/AutocompleteDictionary.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5edf940611247b54a9bb30533b38fbce 3 | timeCreated: 1498846794 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/BeastConsole/Backend/Command.cs: -------------------------------------------------------------------------------- 1 | namespace BeastConsole.Backend.Internal 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | 6 | internal class Command 7 | { 8 | internal Action m_command = null; 9 | internal string m_name = null; 10 | internal string m_description = "(no description)"; 11 | internal ConsoleBackend m_backend; 12 | 13 | internal Dictionary> m_commanddict = new Dictionary>(); 14 | 15 | internal Command(string name, string description, ConsoleBackend backend) 16 | { 17 | m_name = name; 18 | m_description = description; 19 | m_backend = backend; 20 | } 21 | 22 | internal void AddCommand(object owner, Action command) 23 | { 24 | m_commanddict.Add(owner, command); 25 | m_command += command; 26 | } 27 | 28 | internal void RemoveCommand(object owner) 29 | { 30 | m_command -= m_commanddict[owner]; 31 | } 32 | 33 | internal virtual void Execute(string line) 34 | { 35 | if (m_command == null) 36 | { 37 | BeastConsole.Console.WriteLine("Missing target method for command: " + line); 38 | } 39 | else 40 | { 41 | m_command(line.Split(' ')); 42 | } 43 | } 44 | 45 | public override string ToString() 46 | { 47 | return m_name; 48 | } 49 | 50 | protected object StringToObject(string value, Type type) 51 | { 52 | object result = null; 53 | 54 | try 55 | { 56 | if (type == typeof(bool)) 57 | { 58 | if (value == "0") 59 | { 60 | result = System.Convert.ChangeType("false", typeof(bool)); 61 | } 62 | else if (value == "1") 63 | { 64 | result = System.Convert.ChangeType("true", typeof(bool)); 65 | } 66 | else 67 | result = System.Convert.ChangeType(value, type); 68 | } 69 | else 70 | result = System.Convert.ChangeType(value, type); 71 | } 72 | catch (Exception e) 73 | { 74 | BeastConsole.Console.WriteLine("command/variable | " + m_name + " : " + e.Message); 75 | } 76 | 77 | return result; 78 | } 79 | } 80 | } -------------------------------------------------------------------------------- /Assets/BeastConsole/Backend/Command.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: accb0db5d98d8f7468a90f703bcb2817 3 | timeCreated: 1498846987 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/BeastConsole/Backend/ConsoleBackend.cs: -------------------------------------------------------------------------------- 1 | namespace BeastConsole.Backend 2 | { 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Reflection; 7 | using BeastConsole.Backend.Internal; 8 | using BeastConsole.GUI; 9 | #if UNITY_EDITOR 10 | using UnityEditor; 11 | #endif 12 | // Copyright (c) 2014 Cranium Software 13 | // SmartConsole 14 | // 15 | // A Quake style debug console where you can add variables with the 16 | // CreateVariable functions and commands with the RegisterCommand functions 17 | // the variables wrap their underlying types, the commands are delegates 18 | // taking a string with the line of console input and returning void 19 | // TODO: 20 | // * sort out spammy history and 'return' key handling on mobile platforms 21 | // * improve cvar interface 22 | // * allow history to scroll 23 | // * improve autocomplete 24 | // * allow executing console script from file 25 | using UnityEngine; 26 | 27 | // SE: broadly patterned after the debug console implementation from GLToy... 28 | // https://code.google.com/p/gltoy/source/browse/trunk/GLToy/Independent/Core/Console/GLToy_Console.h 29 | /// 30 | /// A Quake style debug console - should be added to an otherwise empty game object and have a font set in the inspector 31 | /// 32 | internal class ConsoleBackend 33 | { 34 | 35 | internal Action OnWriteLine = delegate { }; 36 | internal Action OnExecutedCommand = delegate { }; 37 | 38 | internal GameObject m_textInput = null; 39 | internal AutoCompleteDictionary m_commandDictionary = new AutoCompleteDictionary(); 40 | internal AutoCompleteDictionary m_variableDictionary = new AutoCompleteDictionary(); 41 | internal AutoCompleteDictionary m_attributeCommandsDictionary = new AutoCompleteDictionary(); 42 | internal AutoCompleteDictionary m_masterDictionary = new AutoCompleteDictionary(); 43 | internal Trie m_commandsTrie = new Trie(); 44 | internal List m_commandHistory = new List(); 45 | internal List m_outputHistory = new List(); 46 | internal string m_lastExceptionCallStack = "(none yet)"; 47 | internal string m_lastErrorCallStack = "(none yet)"; 48 | internal string m_lastWarningCallStack = "(none yet)"; 49 | 50 | private string commandPrefix; 51 | private string errorPrefix; 52 | private string warningPrefix; 53 | private string logPrefix; 54 | private string greyColor; 55 | 56 | 57 | // --- internals 58 | internal ConsoleBackend(bool handleLogs, ConsoleGui.Options options) 59 | { 60 | // run this only once... 61 | if (m_textInput != null) 62 | { 63 | return; 64 | } 65 | #if UNITY_EDITOR 66 | // Application.logMessageReceived += LogHandler; 67 | #endif 68 | 69 | commandPrefix = ConsoleUtility.ToHex(options.colors.command) + "[CMD]: "; 70 | errorPrefix = ConsoleUtility.ToHex(options.colors.error) + "[ERR]: "; 71 | warningPrefix = ConsoleUtility.ToHex(options.colors.warning) + "[WNG]: "; 72 | logPrefix = ConsoleUtility.ToHex(options.colors.log) + "[LOG]: "; 73 | greyColor = ConsoleUtility.ToHex(options.colors.suggestionGreyed); 74 | 75 | RegisterCommand("echo", "writes to the console log (alias for echo)", this, Echo); 76 | RegisterCommand("list", "lists all currently registered console variables", this, ListCvars); 77 | RegisterCommand("print", "writes to the console log", this, Echo); 78 | RegisterCommand("quit", "quit the game (not sure this works with iOS/Android)", this, Quit); 79 | 80 | // RegisterCommand("help", "displays help information for console command where available", this, Help); 81 | // RegisterCommand("callstack.warning", "display the call stack for the last warning message", LastWarningCallStack); 82 | // RegisterCommand("callstack.error", "display the call stack for the last error message", LastErrorCallStack); 83 | // RegisterCommand("callstack.exception", "display the call stack for the last exception message", LastExceptionCallStack); 84 | CollectAllData(); 85 | 86 | if (handleLogs) 87 | { 88 | Application.logMessageReceived += LogHandler; 89 | } 90 | } 91 | 92 | 93 | 94 | internal void CollectAllData() 95 | { 96 | Assembly assembly = Assembly.Load("Assembly-CSharp"); 97 | 98 | var types = assembly.GetTypes(); 99 | 100 | BindingFlags flags = BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance; 101 | 102 | foreach (var type in types) 103 | { 104 | var doparse = type.GetCustomAttribute(typeof(ConsoleParseAttribute)); 105 | if (doparse == null) 106 | continue; 107 | 108 | var methods = type.GetMethods(flags); 109 | 110 | foreach (var method in methods) 111 | { 112 | var atr = method.GetCustomAttribute(typeof(ConsoleCommandAttribute), false); 113 | if (atr != null) 114 | { 115 | RegisterAttributeCommand(method, atr as ConsoleCommandAttribute); 116 | } 117 | } 118 | 119 | var fields = type.GetFields(flags); 120 | 121 | foreach (var field in fields) 122 | { 123 | 124 | var atr = field.GetCustomAttribute(typeof(ConsoleVariableAttribute), false); 125 | if (atr != null) 126 | { 127 | RegisterAttributeVariableField(field, atr as ConsoleVariableAttribute); 128 | } 129 | } 130 | 131 | var properties = type.GetProperties(flags); 132 | 133 | foreach (var prop in properties) 134 | { 135 | var atr = prop.GetCustomAttribute(typeof(ConsoleVariableAttribute), false); 136 | if (atr != null) 137 | { 138 | RegisterAttributeVariableProp(prop, atr as ConsoleVariableAttribute); 139 | } 140 | } 141 | } 142 | } 143 | 144 | internal void WriteLine(string line) 145 | { 146 | m_outputHistory.Add(line); 147 | OnWriteLine(line); 148 | } 149 | 150 | 151 | internal void Print(string message) 152 | { 153 | WriteLine(message); 154 | } 155 | 156 | /// 157 | /// Execute a string as if it were a single line of input to the console 158 | /// 159 | internal void ExecuteLine(string inputLine) 160 | { 161 | string[] words = CComParameterSplit(inputLine); 162 | if (words.Length > 0) 163 | { 164 | try 165 | { 166 | m_masterDictionary.TryGetValue(words[0], out Command com); 167 | if (com != null) 168 | { 169 | WriteLine(ConsoleUtility.WrapInColor(commandPrefix + inputLine, "")); 170 | m_masterDictionary[words[0]].Execute(inputLine); 171 | OnExecutedCommand(inputLine, com); 172 | } 173 | else 174 | { 175 | WriteLine("Unrecognised command or variable name: " + words[0] + ""); 176 | } 177 | } 178 | finally 179 | { 180 | m_commandHistory.Add(inputLine); 181 | } 182 | } 183 | } 184 | // public static void ExecuteFile( string path ) {} //... 185 | internal void RemoveCommandIfExists(string name, object owner) 186 | { 187 | m_commandDictionary.TryGetValue(name, out Command comm); 188 | if (comm != null) 189 | { 190 | comm.RemoveCommand(owner); 191 | if (comm.m_command.GetInvocationList().Length == 0) 192 | { 193 | m_commandDictionary.Remove(name); 194 | m_masterDictionary.Remove(name); 195 | } 196 | } 197 | } 198 | /// 199 | /// Register a console command with an example of usage and a help description 200 | /// e.g. SmartConsole.RegisterCommand( "echo", "echo ", "writes to the console log", SmartConsole.Echo ); 201 | /// 202 | internal void RegisterCommand(string name, string helpDescription, object owner, Action callback) 203 | { 204 | 205 | m_masterDictionary.TryGetValue(name, out Command comm); 206 | if (comm != null) 207 | { 208 | comm.AddCommand(owner, callback); 209 | return; 210 | } 211 | else 212 | { 213 | Command command = new Command(name, helpDescription, this); 214 | command.AddCommand(owner, callback); 215 | m_commandDictionary.Add(name, command); 216 | m_masterDictionary.Add(name, command); 217 | m_commandsTrie.Add(new TrieEntry(name, name)); 218 | } 219 | } 220 | 221 | private void RegisterAttributeCommand(MethodInfo info, ConsoleCommandAttribute attr) 222 | { 223 | string commandName = attr.PrefixOnly ? attr.name + "." + info.Name : attr.name; 224 | 225 | m_masterDictionary.TryGetValue(commandName, out Command comm); 226 | if (comm != null) 227 | { 228 | Debug.LogError("Multiple Attribute ConsoleCommands with the same name: " + commandName + " , this is not allowed."); 229 | return; 230 | } 231 | else 232 | { 233 | AttributeCommand cmd = new AttributeCommand(commandName, attr.description, this); 234 | cmd.Initialize(info); 235 | m_attributeCommandsDictionary.Add(commandName, cmd); 236 | m_masterDictionary.Add(commandName, cmd); 237 | m_commandsTrie.Add(new TrieEntry(commandName, commandName)); 238 | } 239 | } 240 | 241 | internal void RegisterVariable(Action setter, object owner, string name, string desc) 242 | { 243 | m_masterDictionary.TryGetValue(name, out Command comm); 244 | if (comm != null) 245 | { 246 | var variable = comm as Variable; 247 | variable.Add(owner, setter); 248 | return; 249 | } 250 | else 251 | { 252 | Variable returnValue = new Variable(name, desc, setter, owner, this); 253 | m_variableDictionary.Add(name, returnValue); 254 | m_masterDictionary.Add(name, returnValue); 255 | m_commandsTrie.Add(new TrieEntry(name, name)); 256 | 257 | } 258 | } 259 | 260 | internal void RegisterAttributeVariableField(FieldInfo info, ConsoleVariableAttribute attr) 261 | { 262 | m_masterDictionary.TryGetValue(attr.name, out Command comm); 263 | if (comm != null) 264 | { 265 | Debug.LogError("Multiple Attribute Variables with the same name: " + attr.name + " , this is not allowed."); 266 | return; 267 | } 268 | else 269 | { 270 | FieldCommand cmd = new FieldCommand(attr.name, attr.description, this); 271 | cmd.Initialize(info); 272 | m_variableDictionary.Add(attr.name, cmd); 273 | m_masterDictionary.Add(attr.name, cmd); 274 | m_commandsTrie.Add(new TrieEntry(attr.name, attr.name)); 275 | } 276 | } 277 | 278 | internal void RegisterAttributeVariableProp(PropertyInfo info, ConsoleVariableAttribute attr) 279 | { 280 | m_masterDictionary.TryGetValue(attr.name, out Command comm); 281 | if (comm != null) 282 | { 283 | Debug.LogError("Multiple Attribute Variables with the same name: " + attr.name + " , this is not allowed."); 284 | return; 285 | } 286 | else 287 | { 288 | PropertyCommand cmd = new PropertyCommand(attr.name, attr.description, this); 289 | cmd.Initialize(info); 290 | m_variableDictionary.Add(attr.name, cmd); 291 | m_masterDictionary.Add(attr.name, cmd); 292 | m_commandsTrie.Add(new TrieEntry(attr.name, attr.name)); 293 | } 294 | } 295 | 296 | internal void UnregisterVariable(string name, object owner) 297 | { 298 | 299 | m_variableDictionary.TryGetValue(name, out Command comm); 300 | if (comm != null) 301 | { 302 | var variable = comm as Variable; 303 | variable.Remove(owner); 304 | return; 305 | } 306 | 307 | m_variableDictionary.Remove(name); 308 | m_masterDictionary.Remove(name); 309 | } 310 | /// 311 | /// Destroy a console variable (so its name can be reused) 312 | /// 313 | internal void UnregisterVariable(Variable variable) where T : new() 314 | { 315 | m_variableDictionary.Remove(variable.m_name); 316 | m_masterDictionary.Remove(variable.m_name); 317 | } 318 | 319 | 320 | private void Echo(string[] parameters) 321 | { 322 | string outputMessage = ""; 323 | for (int i = 1; i < parameters.Length; ++i) 324 | { 325 | outputMessage += parameters[i] + " "; 326 | } 327 | if (outputMessage.EndsWith(" ")) 328 | { 329 | outputMessage.Substring(0, outputMessage.Length - 1); 330 | } 331 | WriteLine(outputMessage); 332 | } 333 | 334 | // private static void LastExceptionCallStack(string parameters) { 335 | // DumpCallStack(s_lastExceptionCallStack); 336 | // } 337 | // private static void LastErrorCallStack(string parameters) { 338 | // DumpCallStack(s_lastErrorCallStack); 339 | // } 340 | // private static void LastWarningCallStack(string parameters) { 341 | // DumpCallStack(s_lastWarningCallStack); 342 | // } 343 | 344 | private void Quit(string[] parameters) 345 | { 346 | #if UNITY_EDITOR 347 | EditorApplication.isPlaying = false; 348 | #endif 349 | Application.Quit(); 350 | } 351 | 352 | private void ListCvars(string[] parameters) 353 | { 354 | string outputStr = ""; 355 | foreach (Command cmd in m_masterDictionary.Values) 356 | { 357 | outputStr += cmd.m_name + " - "; 358 | outputStr += ConsoleUtility.WrapInColor(greyColor, cmd.m_description) + "\n"; 359 | 360 | } 361 | WriteLine("All Commands : "); 362 | WriteLine(outputStr); 363 | } 364 | 365 | public enum myLogType 366 | { 367 | error, 368 | warning, 369 | confirmation, 370 | log 371 | } 372 | 373 | private void LogHandler(string message, string stack, LogType type) 374 | { 375 | switch (type) 376 | { 377 | case LogType.Assert: 378 | { 379 | WriteLine(ConsoleUtility.WrapInColor(warningPrefix, message)); 380 | break; 381 | } 382 | case LogType.Warning: 383 | { 384 | WriteLine(ConsoleUtility.WrapInColor(warningPrefix, message)); 385 | break; 386 | } 387 | case LogType.Error: 388 | { 389 | WriteLine(ConsoleUtility.WrapInColor(errorPrefix, message)); 390 | break; 391 | } 392 | case LogType.Exception: 393 | { 394 | WriteLine(ConsoleUtility.WrapInColor(errorPrefix, message)); 395 | break; 396 | } 397 | case LogType.Log: 398 | { 399 | WriteLine(ConsoleUtility.WrapInColor(logPrefix, message)); 400 | break; 401 | } 402 | default: 403 | { 404 | break; 405 | } 406 | } 407 | } 408 | internal string[] CComParameterSplit(string parameters) 409 | { 410 | return parameters.Split(new char[] { ' ' }, System.StringSplitOptions.RemoveEmptyEntries); 411 | } 412 | internal string[] CComParameterSplit(string parameters, int requiredParameters) 413 | { 414 | string[] split = CComParameterSplit(parameters); 415 | if (split.Length < (requiredParameters + 1)) 416 | { 417 | WriteLine("Error: not enough parameters for command. Expected " + requiredParameters + " found " + (split.Length - 1)); 418 | } 419 | if (split.Length > (requiredParameters + 1)) 420 | { 421 | int extras = ((split.Length - 1) - requiredParameters); 422 | WriteLine("Warning: " + extras + "additional parameters will be dropped:"); 423 | for (int i = split.Length - extras; i < split.Length; ++i) 424 | { 425 | WriteLine("\"" + split[i] + "\""); 426 | } 427 | } 428 | return split; 429 | } 430 | internal string[] CVarParameterSplit(string parameters) 431 | { 432 | string[] split = CComParameterSplit(parameters); 433 | if (split.Length == 0) 434 | { 435 | WriteLine("Error: not enough parameters to set or display the value of a console variable."); 436 | } 437 | if (split.Length > 2) 438 | { 439 | int extras = (split.Length - 3); 440 | WriteLine("Warning: " + extras + "additional parameters will be dropped:"); 441 | for (int i = split.Length - extras; i < split.Length; ++i) 442 | { 443 | WriteLine("\"" + split[i] + "\""); 444 | } 445 | } 446 | return split; 447 | } 448 | 449 | internal void DumpCallStack(string stackString) 450 | { 451 | string[] lines = stackString.Split(new char[] { '\r', '\n' }); 452 | if (lines.Length == 0) 453 | { 454 | return; 455 | } 456 | int ignoreCount = 0; 457 | while ((lines[lines.Length - 1 - ignoreCount].Length == 0) && (ignoreCount < lines.Length)) 458 | { 459 | ++ignoreCount; 460 | } 461 | int lineCount = lines.Length - ignoreCount; 462 | for (int i = 0; i < lineCount; ++i) 463 | { 464 | // SE - if the call stack is 100 deep without recursion you have much bigger problems than you can ever solve with a debugger... 465 | WriteLine((i + 1).ToString() + ((i < 9) ? " " : " ") + lines[i]); 466 | } 467 | } 468 | 469 | 470 | } 471 | } -------------------------------------------------------------------------------- /Assets/BeastConsole/Backend/ConsoleBackend.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3aaed7d5c619f784585e638be5ff7a52 3 | timeCreated: 1498852178 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/BeastConsole/Backend/FieldCommand.cs: -------------------------------------------------------------------------------- 1 | namespace BeastConsole.Backend.Internal { 2 | 3 | using UnityEngine; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Reflection; 7 | 8 | internal class FieldCommand : Command { 9 | 10 | internal FieldInfo m_fieldInfo; 11 | internal Type m_fieldType; 12 | internal Type m_declaringType; 13 | 14 | //If we detect that the field is an RVar 15 | private bool isRVar; 16 | 17 | public FieldCommand(string name, string description, ConsoleBackend backend) : base(name, description, backend) { 18 | } 19 | 20 | internal void Initialize(FieldInfo info) { 21 | 22 | m_fieldInfo = info; 23 | if (m_fieldInfo.FieldType.BaseType.Name.Contains("RVar")) { 24 | isRVar = true; 25 | m_fieldType = m_fieldInfo.FieldType.BaseType.GetGenericArguments()[0]; 26 | } 27 | else { 28 | m_fieldType = m_fieldInfo.FieldType; 29 | } 30 | m_declaringType = m_fieldInfo.DeclaringType; 31 | } 32 | 33 | internal override void Execute(string line) { 34 | 35 | var split = line.TrimEnd().Split(' '); 36 | 37 | if (split.Length <= 1) { 38 | return; 39 | } 40 | 41 | var gos = GameObject.FindObjectsOfType(m_declaringType); 42 | int count = gos.Length; 43 | object param = StringToObject(split[1], m_fieldType); 44 | 45 | for (int i = 0; i < count; i++) { 46 | if (isRVar) { 47 | object rvar = m_fieldInfo.GetValue(gos[i]); 48 | PropertyInfo setter = rvar.GetType().GetProperty("Value"); 49 | setter.SetValue(rvar, param, null); 50 | } 51 | else { 52 | m_fieldInfo.SetValue(gos[i], param); 53 | 54 | } 55 | } 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Assets/BeastConsole/Backend/FieldCommand.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: da86ba34632cd8f47a42d63eec972561 3 | timeCreated: 1499223179 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/BeastConsole/Backend/PropertyCommand.cs: -------------------------------------------------------------------------------- 1 | namespace BeastConsole.Backend.Internal { 2 | 3 | using UnityEngine; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Reflection; 7 | 8 | internal class PropertyCommand : Command { 9 | 10 | internal PropertyInfo m_propertyInfo; 11 | 12 | internal Type m_Type; 13 | internal Type m_declaringType; 14 | 15 | public PropertyCommand(string name, string description, ConsoleBackend backend) : base(name, description, backend) { 16 | } 17 | 18 | internal void Initialize(PropertyInfo info) { 19 | 20 | m_propertyInfo = info; 21 | m_Type = m_propertyInfo.PropertyType; 22 | m_declaringType = m_propertyInfo.DeclaringType; 23 | 24 | } 25 | 26 | internal override void Execute(string line) { 27 | 28 | var split = line.TrimEnd().Split(' '); 29 | 30 | if(split.Length <= 1) { 31 | return; 32 | } 33 | 34 | object param = StringToObject(split[1], m_Type); 35 | 36 | var gos = GameObject.FindObjectsOfType(m_declaringType); 37 | int count = gos.Length; 38 | for (int i = 0; i < count; i++) { 39 | m_propertyInfo.SetValue(gos[i], param, null); 40 | } 41 | } 42 | } 43 | 44 | } -------------------------------------------------------------------------------- /Assets/BeastConsole/Backend/PropertyCommand.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f330354fae32a3541b26e201e3a86d82 3 | timeCreated: 1499223483 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/BeastConsole/Backend/Trie.cs: -------------------------------------------------------------------------------- 1 | namespace BeastConsole.Backend { 2 | 3 | 4 | using System; 5 | using System.Collections; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | 9 | ///TRIE implementation by Kirill Polishchuk 10 | ///https://github.com/kpol/trie 11 | 12 | /// 13 | /// Implementation of trie data structure. 14 | /// 15 | /// The type of values in the trie. 16 | public class Trie : IDictionary { 17 | private readonly TrieNode root; 18 | 19 | private int count; 20 | 21 | /// 22 | /// Initializes a new instance of the . 23 | /// 24 | /// Comparer. 25 | public Trie(IEqualityComparer comparer) { 26 | root = new TrieNode(char.MinValue, comparer); 27 | } 28 | 29 | /// 30 | /// Initializes a new instance of the . 31 | /// 32 | public Trie() 33 | : this(EqualityComparer.Default) { 34 | } 35 | 36 | /// 37 | /// Gets the number of elements contained in the . 38 | /// 39 | /// 40 | /// The number of elements contained in the . 41 | /// 42 | public int Count 43 | { 44 | get { 45 | return count; 46 | } 47 | } 48 | 49 | /// 50 | /// Gets an containing the keys of the . 51 | /// 52 | /// 53 | /// An containing the keys of the object that implements . 54 | /// 55 | public ICollection Keys 56 | { 57 | get { 58 | return GetAllNodes().Select(n => n.Key).ToArray(); 59 | } 60 | } 61 | 62 | /// 63 | /// Gets an containing the values in the . 64 | /// 65 | /// 66 | /// An containing the values in the object that implements . 67 | /// 68 | public ICollection Values 69 | { 70 | get { 71 | return GetAllNodes().Select(n => n.Value).ToArray(); 72 | } 73 | } 74 | 75 | bool ICollection>.IsReadOnly 76 | { 77 | get { 78 | return false; 79 | } 80 | } 81 | 82 | /// 83 | /// Gets or sets the element with the specified key. 84 | /// 85 | /// 86 | /// The element with the specified key. 87 | /// 88 | /// The key of the element to get or set. 89 | /// is null. 90 | /// The property is retrieved and is not found. 91 | public TValue this[string key] 92 | { 93 | get { 94 | TValue value; 95 | 96 | if (!TryGetValue(key, out value)) { 97 | throw new KeyNotFoundException("The given charKey was not present in the trie."); 98 | } 99 | 100 | return value; 101 | } 102 | 103 | set { 104 | TrieNode node; 105 | 106 | if (TryGetNode(key, out node)) { 107 | SetTerminalNode(node, value); 108 | } 109 | else { 110 | Add(key, value); 111 | } 112 | } 113 | } 114 | 115 | /// 116 | /// Adds an element with the provided charKey and value to the . 117 | /// 118 | /// The object to use as the charKey of the element to add. 119 | /// The object to use as the value of the element to add. 120 | /// is null. 121 | /// An element with the same charKey already exists in the . 122 | public void Add(string key, TValue value) { 123 | if (key == null) { 124 | throw new ArgumentNullException("key"); 125 | } 126 | 127 | var node = root; 128 | 129 | foreach (var c in key) { 130 | node = node.Add(c); 131 | } 132 | 133 | if (node.IsTerminal) { 134 | throw new ArgumentException(string.Format("An element with the same charKey already exists: '{0}'", key), "key"); 135 | } 136 | 137 | SetTerminalNode(node, value); 138 | 139 | count++; 140 | } 141 | 142 | /// 143 | /// Adds an item to the . 144 | /// 145 | /// The object to add to the . 146 | /// An element with the same charKey already exists in the . 147 | public void Add(TrieEntry item) { 148 | Add(item.Key, item.Value); 149 | } 150 | 151 | /// 152 | /// Adds the elements of the specified collection to the . 153 | /// 154 | /// The collection whose elements should be added to the . The items should have unique keys. 155 | /// An element with the same charKey already exists in the . 156 | public void AddRange(IEnumerable> collection) { 157 | foreach (var item in collection) { 158 | Add(item.Key, item.Value); 159 | } 160 | } 161 | 162 | /// 163 | /// Removes all items from the . 164 | /// 165 | /// The is read-only. 166 | public void Clear() { 167 | root.Clear(); 168 | count = 0; 169 | } 170 | 171 | /// 172 | /// Determines whether the contains an element with the specified charKey. 173 | /// 174 | /// 175 | /// true if the contains an element with the charKey; otherwise, false. 176 | /// 177 | /// The charKey to locate in the . 178 | /// is null. 179 | public bool ContainsKey(string key) { 180 | TValue value; 181 | 182 | return TryGetValue(key, out value); 183 | } 184 | 185 | /// 186 | /// Gets items by key prefix. 187 | /// 188 | /// Key prefix. 189 | /// Collection of items which have key with specified key. 190 | public IEnumerable> GetByPrefix(string prefix) { 191 | var node = root; 192 | 193 | foreach (var item in prefix) { 194 | if (!node.TryGetNode(item, out node)) { 195 | return Enumerable.Empty>(); 196 | } 197 | } 198 | 199 | return node.GetByPrefix(); 200 | } 201 | 202 | /// 203 | /// Returns an enumerator that iterates through the collection. 204 | /// 205 | /// 206 | /// A that can be used to iterate through the collection. 207 | /// 208 | /// 1 209 | public IEnumerator> GetEnumerator() { 210 | return GetAllNodes().Select(n => new KeyValuePair(n.Key, n.Value)).GetEnumerator(); 211 | } 212 | 213 | /// 214 | /// Removes the element with the specified charKey from the . 215 | /// 216 | /// 217 | /// true if the element is successfully removed; otherwise, false. This method also returns false if was not found in the original . 218 | /// 219 | /// The charKey of the element to remove. 220 | /// is null. 221 | /// The is read-only. 222 | public bool Remove(string key) { 223 | if (key == null) { 224 | throw new ArgumentNullException("key"); 225 | } 226 | 227 | TrieNode node; 228 | 229 | if (!TryGetNode(key, out node)) { 230 | return false; 231 | } 232 | 233 | if (!node.IsTerminal) { 234 | return false; 235 | } 236 | 237 | RemoveNode(node); 238 | 239 | return true; 240 | } 241 | 242 | /// 243 | /// Gets the value associated with the specified key. 244 | /// 245 | /// 246 | /// true if the object that implements contains an element with the specified key; otherwise, false. 247 | /// 248 | /// The key whose value to get. 249 | /// When this method returns, the value associated with the specified key, if the key is found; otherwise, the default value for the type of the parameter. This parameter is passed uninitialized. 250 | /// is null. 251 | public bool TryGetValue(string key, out TValue value) { 252 | if (key == null) { 253 | throw new ArgumentNullException("key"); 254 | } 255 | 256 | TrieNode node; 257 | value = default(TValue); 258 | 259 | if (!TryGetNode(key, out node)) { 260 | return false; 261 | } 262 | 263 | if (!node.IsTerminal) { 264 | return false; 265 | } 266 | 267 | value = node.Value; 268 | 269 | return true; 270 | } 271 | 272 | void ICollection>.Add(KeyValuePair item) { 273 | Add(item.Key, item.Value); 274 | } 275 | 276 | bool ICollection>.Contains(KeyValuePair item) { 277 | TrieNode node; 278 | 279 | if (!TryGetNode(item.Key, out node)) { 280 | return false; 281 | } 282 | 283 | return node.IsTerminal && EqualityComparer.Default.Equals(node.Value, item.Value); 284 | } 285 | 286 | void ICollection>.CopyTo(KeyValuePair[] array, int arrayIndex) { 287 | Array.Copy(GetAllNodes().Select(n => new KeyValuePair(n.Key, n.Value)).ToArray(), 0, array, arrayIndex, Count); 288 | } 289 | 290 | IEnumerator IEnumerable.GetEnumerator() { 291 | return GetEnumerator(); 292 | } 293 | 294 | bool ICollection>.Remove(KeyValuePair item) { 295 | TrieNode node; 296 | 297 | if (!TryGetNode(item.Key, out node)) { 298 | return false; 299 | } 300 | 301 | if (!node.IsTerminal) { 302 | return false; 303 | } 304 | 305 | if (!EqualityComparer.Default.Equals(node.Value, item.Value)) { 306 | return false; 307 | } 308 | 309 | RemoveNode(node); 310 | 311 | return true; 312 | } 313 | 314 | private static void SetTerminalNode(TrieNode node, TValue value) { 315 | node.IsTerminal = true; 316 | node.Value = value; 317 | } 318 | 319 | private IEnumerable GetAllNodes() { 320 | return root.GetAllNodes(); 321 | } 322 | 323 | private void RemoveNode(TrieNode node) { 324 | node.Remove(); 325 | count--; 326 | } 327 | 328 | private bool TryGetNode(string key, out TrieNode node) { 329 | node = root; 330 | 331 | foreach (var c in key) { 332 | if (!node.TryGetNode(c, out node)) { 333 | return false; 334 | } 335 | } 336 | 337 | return true; 338 | } 339 | 340 | /// 341 | /// 's node. 342 | /// 343 | private sealed class TrieNode { 344 | private readonly Dictionary children; 345 | 346 | private readonly IEqualityComparer comparer; 347 | 348 | private readonly char keyChar; 349 | 350 | internal TrieNode(char keyChar, IEqualityComparer comparer) { 351 | this.keyChar = keyChar; 352 | this.comparer = comparer; 353 | children = new Dictionary(comparer); 354 | } 355 | 356 | internal bool IsTerminal { get; set; } 357 | 358 | internal string Key 359 | { 360 | get { 361 | ////var result = new StringBuilder().Append(keyChar); 362 | 363 | ////TrieNode node = this; 364 | 365 | ////while ((node = node.Parent).Parent != null) 366 | ////{ 367 | //// result.Insert(0, node.keyChar); 368 | ////} 369 | 370 | ////return result.ToString(); 371 | 372 | var stack = new Stack(); 373 | stack.Push(keyChar); 374 | 375 | TrieNode node = this; 376 | 377 | while ((node = node.Parent).Parent != null) { 378 | stack.Push(node.keyChar); 379 | } 380 | 381 | return new string(stack.ToArray()); 382 | } 383 | } 384 | 385 | internal TValue Value { get; set; } 386 | 387 | private TrieNode Parent { get; set; } 388 | 389 | internal TrieNode Add(char key) { 390 | TrieNode childNode; 391 | 392 | if (!children.TryGetValue(key, out childNode)) { 393 | childNode = new TrieNode(key, comparer) { 394 | Parent = this 395 | }; 396 | 397 | children.Add(key, childNode); 398 | } 399 | 400 | return childNode; 401 | } 402 | 403 | internal void Clear() { 404 | children.Clear(); 405 | } 406 | 407 | internal IEnumerable GetAllNodes() { 408 | foreach (var child in children) { 409 | if (child.Value.IsTerminal) { 410 | yield return child.Value; 411 | } 412 | 413 | foreach (var item in child.Value.GetAllNodes()) { 414 | if (item.IsTerminal) { 415 | yield return item; 416 | } 417 | } 418 | } 419 | } 420 | 421 | internal IEnumerable> GetByPrefix() { 422 | if (IsTerminal) { 423 | yield return new TrieEntry(Key, Value); 424 | } 425 | 426 | foreach (var item in children) { 427 | foreach (var element in item.Value.GetByPrefix()) { 428 | yield return element; 429 | } 430 | } 431 | } 432 | 433 | internal void Remove() { 434 | IsTerminal = false; 435 | 436 | if (children.Count == 0 && Parent != null) { 437 | Parent.children.Remove(keyChar); 438 | 439 | if (!Parent.IsTerminal) { 440 | Parent.Remove(); 441 | } 442 | } 443 | } 444 | 445 | internal bool TryGetNode(char key, out TrieNode node) { 446 | return children.TryGetValue(key, out node); 447 | } 448 | } 449 | } 450 | } -------------------------------------------------------------------------------- /Assets/BeastConsole/Backend/Trie.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e4b4b2f20d5805346a2761db44aef3da 3 | timeCreated: 1498950174 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/BeastConsole/Backend/TrieEntry.cs: -------------------------------------------------------------------------------- 1 | namespace BeastConsole.Backend { 2 | 3 | /// 4 | /// Defines a key/value pair that can be set or retrieved from . 5 | /// 6 | public struct TrieEntry 7 | { 8 | /// 9 | /// Initializes a new instance of the structure with the specified key and value. 10 | /// 11 | /// The object defined in each key/value pair. 12 | /// The definition associated with key. 13 | public TrieEntry(string key, TValue value) 14 | : this() 15 | { 16 | Key = key; 17 | Value = value; 18 | } 19 | 20 | /// 21 | /// Gets the key in the key/value pair. 22 | /// 23 | public string Key { get; private set; } 24 | 25 | /// 26 | /// Gets the value in the key/value pair. 27 | /// 28 | public TValue Value { get; private set; } 29 | 30 | /// 31 | /// Returns the fully qualified type name of this instance. 32 | /// 33 | /// 34 | /// A containing a fully qualified type name. 35 | /// 36 | /// 2 37 | public override string ToString() 38 | { 39 | return string.Format("[{0}, {1}]", Key, Value); 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /Assets/BeastConsole/Backend/TrieEntry.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d3b5c1ecae128e245a1ca327480313b0 3 | timeCreated: 1498950174 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/BeastConsole/Backend/Variable.cs: -------------------------------------------------------------------------------- 1 | namespace BeastConsole.Backend.Internal { 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | 6 | // SE - this is a bit elaborate, needed to provide a way to do this 7 | // without relying on memory addresses or pointers... which has resulted in 8 | // a little blob of bloat and overhead for something that should be trivial... :/ 9 | /// 10 | /// A class representing a console variable 11 | /// 12 | internal class Variable : Command { 13 | 14 | internal Action m_setter; 15 | internal Dictionary> m_dict = new Dictionary>(); 16 | 17 | internal Variable(string name, string desc, Action setter, object owner, ConsoleBackend backend) : base(name, desc, backend) { 18 | Add(owner, setter); 19 | } 20 | 21 | internal void Set(T val) // SE: I don't seem to know enough C# to provide a user friendly assignment operator solution 22 | { 23 | m_setter(val); 24 | } 25 | 26 | internal void Add(object owner, Action setter) { 27 | m_dict.Add(owner, setter); 28 | m_setter += setter; 29 | } 30 | 31 | internal void Remove(object owner) { 32 | m_setter -= m_dict[owner]; 33 | } 34 | 35 | internal override void Execute(string parameters) { 36 | string[] split = m_backend.CVarParameterSplit(parameters); 37 | if ((split.Length > 1) && m_backend.m_variableDictionary.ContainsKey(split[0])) { 38 | Variable variable = m_backend.m_variableDictionary[split[0]] as Variable; 39 | string conjunction = " is set to "; 40 | if (split.Length == 2) { 41 | variable.SetFromString(split[1]); 42 | conjunction = " has been set to "; 43 | } 44 | m_backend.WriteLine(variable.m_name + conjunction + split[1]); 45 | } 46 | } 47 | 48 | private void SetFromString(string value) { 49 | if (typeof(T) == typeof(bool)) { 50 | if (value == "0") { 51 | Set((T)System.Convert.ChangeType("false", typeof(T))); 52 | } 53 | else if (value == "1") { 54 | Set((T)System.Convert.ChangeType("true", typeof(T))); 55 | } 56 | else 57 | Set((T)System.Convert.ChangeType(value, typeof(T))); 58 | } 59 | else 60 | Set((T)System.Convert.ChangeType(value, typeof(T))); 61 | } 62 | } 63 | } -------------------------------------------------------------------------------- /Assets/BeastConsole/Backend/Variable.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 96add57749f0d0a4fa7759ee2afe4202 3 | timeCreated: 1498846927 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/BeastConsole/Console.cs: -------------------------------------------------------------------------------- 1 | namespace BeastConsole 2 | { 3 | #pragma warning disable 0649 4 | using System; 5 | using BeastConsole.Backend; 6 | using BeastConsole.GUI; 7 | using UnityEngine; 8 | 9 | public class Console : MonoBehaviour 10 | { 11 | 12 | public static event System.Action OnStateChanged = delegate { }; 13 | 14 | 15 | private static Console _instance; 16 | public static Console instance 17 | { 18 | get 19 | { 20 | if (!_instance) 21 | _instance = GameObject.FindObjectOfType(); 22 | return _instance; 23 | } 24 | } 25 | 26 | [SerializeField] 27 | internal ConsoleGui.Options consoleOptions; 28 | 29 | private GameObject m_consoleRoot; 30 | private ConsoleGui m_gui; 31 | private ConsoleBackend m_backend; 32 | 33 | 34 | private void Awake() 35 | { 36 | _instance = this; 37 | m_backend = new ConsoleBackend(consoleOptions.LogHandler, consoleOptions); 38 | m_gui = new ConsoleGui(m_backend, consoleOptions); 39 | ConsoleGui.OnStateChanged += x => OnStateChanged(x); 40 | } 41 | 42 | public static void AddCommand(string name, string description, object owner, Action callback) 43 | { 44 | if (instance != null && instance.m_backend != null) 45 | instance.m_backend.RegisterCommand(name, description, owner, callback); 46 | } 47 | 48 | public static void RemoveCommand(string name, object owner) 49 | { 50 | if (instance != null && instance.m_backend != null) 51 | instance.m_backend.RemoveCommandIfExists(name, owner); 52 | } 53 | public static void AddVariable(string name, string description, Action setter, object owner) 54 | { 55 | if (instance != null && instance.m_backend != null) 56 | instance.m_backend.RegisterVariable(setter, owner, name, description); 57 | } 58 | 59 | public static void RemoveVariable(string name, object owner) 60 | { 61 | if (instance != null && instance.m_backend != null) 62 | instance.m_backend.UnregisterVariable(name, owner); 63 | } 64 | 65 | /// 66 | /// Directly execute command 67 | /// 68 | /// 69 | public static void ExecuteLine(string line) 70 | { 71 | if (instance != null && instance.m_backend != null) 72 | instance.m_backend.ExecuteLine(line); 73 | } 74 | 75 | 76 | /// 77 | /// Supports rich text. 78 | /// 79 | /// 80 | public static void WriteLine(string message) 81 | { 82 | if (instance != null && instance.m_backend != null) 83 | instance.m_backend.WriteLine(message); 84 | } 85 | 86 | private void Update() 87 | { 88 | m_gui.Update(); 89 | } 90 | 91 | private void OnGUI() 92 | { 93 | m_gui.OnGUI(); 94 | } 95 | 96 | 97 | } 98 | } -------------------------------------------------------------------------------- /Assets/BeastConsole/Console.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 095d9b7d1ed2d6c4eaed93370f502cdc 3 | timeCreated: 1474422478 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: -100 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/BeastConsole/ConsoleCommandAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace BeastConsole { 2 | using System; 3 | 4 | [System.AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = true)] 5 | public class ConsoleCommandAttribute : Attribute { 6 | 7 | public readonly string name, description; 8 | public readonly bool PrefixOnly; 9 | 10 | public ConsoleCommandAttribute(string name, string description, bool prefixOnly = false) { 11 | this.name = name; 12 | this.description = description; 13 | this.PrefixOnly = prefixOnly; 14 | } 15 | 16 | public ConsoleCommandAttribute(string name, bool prefixOnly = false) { 17 | this.name = name; 18 | this.description = "no description"; 19 | this.PrefixOnly = prefixOnly; 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /Assets/BeastConsole/ConsoleCommandAttribute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a890065bd122ca84aabd05e7f5c1ea4d 3 | timeCreated: 1499207284 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/BeastConsole/ConsoleParseAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace BeastConsole { 2 | using UnityEngine; 3 | using System; 4 | using System.Collections.Generic; 5 | 6 | [System.AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 7 | public class ConsoleParseAttribute : Attribute { 8 | } 9 | } -------------------------------------------------------------------------------- /Assets/BeastConsole/ConsoleParseAttribute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 87c486b46c445f04d914852e2e237811 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/BeastConsole/ConsolePrefixes.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public static partial class ConsolePrefixes 6 | { 7 | public const string CONSOLE = "console"; 8 | public const string DEBUG = "debug"; 9 | public const string TEST = "test"; 10 | public const string GRAPHICS = "gfx"; 11 | public const string PHYSICS = "physics"; 12 | public const string ENGINE = "engine"; 13 | public const string AUDIO = "audio"; 14 | 15 | } 16 | -------------------------------------------------------------------------------- /Assets/BeastConsole/ConsolePrefixes.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c824a73f84952a94eaf89a116ea056ee 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/BeastConsole/ConsolePrefixes_USER.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public static partial class ConsolePrefixes 6 | { 7 | public const string ACTOR = "actor"; 8 | public const string PAWN = "pawn"; 9 | 10 | } 11 | -------------------------------------------------------------------------------- /Assets/BeastConsole/ConsolePrefixes_USER.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: da0f348d09848e14493825e9dfa5a88e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/BeastConsole/ConsoleUtility.cs: -------------------------------------------------------------------------------- 1 | using System.Text; 2 | using BeastConsole; 3 | using UnityEngine; 4 | 5 | public static class ConsoleUtility 6 | { 7 | private static StringBuilder sb = new StringBuilder(); 8 | private const string COLUMN_SEPARATOR = " | "; 9 | private const char SPACE = ' '; 10 | 11 | 12 | public static string DeNewLine(string message) 13 | { 14 | return message.Replace("\n", " | "); 15 | } 16 | 17 | public static void Print(string line) 18 | { 19 | Console.WriteLine(line); 20 | } 21 | 22 | public static void Print(object obj) 23 | { 24 | Console.WriteLine(obj.ToString()); 25 | } 26 | 27 | public static void RegisterCommand(string name, string description, object owner, System.Action callback) 28 | { 29 | Console.AddCommand(name, description, owner, callback); 30 | } 31 | 32 | public static void PrintTableRow(string A, string B, int columnSize = 20) 33 | { 34 | sb.Clear(); 35 | appendColumn(A, columnSize); 36 | appendColumn(B, columnSize); 37 | sb.Append(COLUMN_SEPARATOR); 38 | 39 | Console.WriteLine(sb.ToString()); 40 | } 41 | 42 | public static void PrintTableRowIndividualSize(string A, string B, int columnSizeA, int columnSizeB) 43 | { 44 | sb.Clear(); 45 | appendColumn(A, columnSizeA); 46 | appendColumn(B, columnSizeB); 47 | sb.Append(COLUMN_SEPARATOR); 48 | 49 | Console.WriteLine(sb.ToString()); 50 | } 51 | 52 | public static void PrintTableRow(string A, string B, string C, int columnSize = 20) 53 | { 54 | sb.Clear(); 55 | appendColumn(A, columnSize); 56 | appendColumn(B, columnSize); 57 | appendColumn(C, columnSize); 58 | sb.Append(COLUMN_SEPARATOR); 59 | 60 | Console.WriteLine(sb.ToString()); 61 | } 62 | 63 | public static void PrintTableRowIndividualSize(string A, string B, string C, int columnSizeA, int columnSizeB, int columnSizeC) 64 | { 65 | sb.Clear(); 66 | appendColumn(A, columnSizeA); 67 | appendColumn(B, columnSizeB); 68 | appendColumn(C, columnSizeC); 69 | sb.Append(COLUMN_SEPARATOR); 70 | 71 | Console.WriteLine(sb.ToString()); 72 | } 73 | 74 | public static void PrintTableTitles(string ATitle, string BTitle, int columnSize = 20) 75 | { 76 | sb.Clear(); 77 | sb.Append(SPACE, COLUMN_SEPARATOR.Length); 78 | appendColumnTitle(ATitle, columnSize); 79 | appendColumnTitle(BTitle, columnSize); 80 | 81 | Console.WriteLine(sb.ToString()); 82 | } 83 | 84 | public static void PrintTableTitlesIndividualSize(string ATitle, string BTitle, int columnSizeA, int columnSizeB) 85 | { 86 | sb.Clear(); 87 | sb.Append(SPACE, COLUMN_SEPARATOR.Length); 88 | appendColumnTitle(ATitle, columnSizeA); 89 | appendColumnTitle(BTitle, columnSizeB); 90 | 91 | Console.WriteLine(sb.ToString()); 92 | } 93 | 94 | public static void PrintTableTitles(string ATitle, string BTitle, string CTitle, int columnSize = 20) 95 | { 96 | sb.Clear(); 97 | sb.Append(SPACE, COLUMN_SEPARATOR.Length); 98 | appendColumnTitle(ATitle, columnSize); 99 | appendColumnTitle(BTitle, columnSize); 100 | appendColumnTitle(CTitle, columnSize); 101 | 102 | Console.WriteLine(sb.ToString()); 103 | } 104 | 105 | public static void PrintTableTitlesIndividualSize(string ATitle, string BTitle, string CTitle, int columnSizeA, int columnSizeB, int columnSizeC) 106 | { 107 | sb.Clear(); 108 | sb.Append(SPACE, COLUMN_SEPARATOR.Length); 109 | appendColumnTitle(ATitle, columnSizeA); 110 | appendColumnTitle(BTitle, columnSizeB); 111 | appendColumnTitle(CTitle, columnSizeC); 112 | 113 | Console.WriteLine(sb.ToString()); 114 | } 115 | 116 | private static void appendColumn(string str, int columnSize) 117 | { 118 | int al = str.Length; 119 | int length = al < columnSize ? al : columnSize; 120 | 121 | sb.Append(COLUMN_SEPARATOR); 122 | sb.Append(str, 0, length); 123 | sb.Append(SPACE, columnSize - length); 124 | } 125 | 126 | private static void appendColumnTitle(string str, int columnSize) 127 | { 128 | int al = str.Length; 129 | int length = al < columnSize ? al : columnSize; 130 | int side = (columnSize - length) / 2; 131 | 132 | sb.Append(SPACE, side); 133 | sb.Append(str, 0, length); 134 | sb.Append(SPACE, side); 135 | sb.Append(SPACE, COLUMN_SEPARATOR.Length); 136 | 137 | } 138 | 139 | 140 | public static string ToHex(Color color) 141 | { 142 | sb.Clear(); 143 | Color32 col = color; 144 | 145 | sb.Append(""); 151 | 152 | return sb.ToString(); 153 | } 154 | 155 | public static int WrapInColor(string color, string value, out string result) 156 | { 157 | sb.Clear(); 158 | sb.Append(color); 159 | sb.Append(value); 160 | sb.Append(""); 161 | result = sb.ToString(); 162 | return sb.Length; 163 | } 164 | 165 | public static string WrapInColor(string color, string value) 166 | { 167 | sb.Clear(); 168 | sb.Append(color); 169 | sb.Append(value); 170 | sb.Append(""); 171 | return sb.ToString(); 172 | } 173 | } 174 | -------------------------------------------------------------------------------- /Assets/BeastConsole/ConsoleUtility.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 54035aff3a141a9458815f58f370ea17 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/BeastConsole/ConsoleVariableAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace BeastConsole { 2 | using UnityEngine; 3 | using System; 4 | using System.Collections.Generic; 5 | 6 | [System.AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] 7 | public class ConsoleVariableAttribute : Attribute { 8 | 9 | public readonly string name, description; 10 | 11 | public ConsoleVariableAttribute(string name, string description) { 12 | this.name = name; 13 | this.description = description; 14 | } 15 | 16 | public ConsoleVariableAttribute(string name) { 17 | this.name = name; 18 | this.description = "no description"; 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /Assets/BeastConsole/ConsoleVariableAttribute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: afa4d62fa9f661a43b5d4043284970b0 3 | timeCreated: 1499212982 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/BeastConsole/Gui.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fe053e6f8bff1cd4f80e869d22013207 3 | folderAsset: yes 4 | timeCreated: 1498846774 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/BeastConsole/Gui/ConsoleGui.cs: -------------------------------------------------------------------------------- 1 | namespace BeastConsole.GUI 2 | { 3 | using System.Collections.Generic; 4 | #pragma warning disable 0649 5 | using System.Linq; 6 | using System.Text; 7 | using BeastConsole.Backend; 8 | using BeastConsole.Backend.Internal; 9 | using UnityEngine; 10 | 11 | internal class ConsoleGui 12 | { 13 | public static event System.Action OnStateChanged = delegate { }; 14 | 15 | internal Options m_options; 16 | [System.Serializable] 17 | internal class Options 18 | { 19 | public KeyCode ConsoleKey = KeyCode.BackQuote; 20 | public float TweenTime = 0.4f; 21 | public int MaxConsoleLines = 120; 22 | public float LinePadding = 10; 23 | public bool LogHandler = true; 24 | public GUISkin skin; 25 | 26 | public Colors colors = new Colors(); 27 | 28 | [System.Serializable] 29 | public class Colors 30 | { 31 | public Color error = new Color(1, 1, 1, 1); 32 | public Color warning = new Color(1, 1, 1, 1); 33 | public Color log = new Color(1, 1, 1, 1); 34 | public Color command = new Color(1, 1, 1, 1); 35 | public Color suggestionGreyed = new Color(1, 1, 1, 1); 36 | } 37 | } 38 | 39 | private GUISkin skin; 40 | 41 | private ConsoleBackend m_backend; 42 | private bool m_consoleShown; 43 | private bool drawConsole; 44 | private bool consoleWasOpened; 45 | private bool InputToggleConsole = false; 46 | private bool GUIToggleConsole = false; 47 | private bool moveToEnd = false; 48 | 49 | private int consoleSize; 50 | private float ConsoleHeight 51 | { 52 | get 53 | { 54 | switch (consoleSize) 55 | { 56 | case 1: 57 | return Screen.height / 3F; 58 | case 2: 59 | return Screen.height / 2F; 60 | case 3: 61 | return (Screen.height / 2F) + (Screen.height / 4F); 62 | 63 | } 64 | 65 | return Screen.height / 3F; 66 | } 67 | } 68 | 69 | 70 | private float m_lerpTime; 71 | private Rect rect_console; 72 | private float console_targetPosition; 73 | private float console_currentPosition; 74 | private Vector2 consoleScrollPosition; 75 | private float ClosedPosition => -(ConsoleHeight + 20F); 76 | private Rect inputFieldRect => new Rect(5, rect_console.y + rect_console.height + 5, 400, skin.textField.CalcHeight(new GUIContent("Input"), 50)); 77 | private int currentSuggestionIndex = -1; 78 | private string currentSuggestion; 79 | private int currentCommandHistoryIndex = -1; 80 | 81 | private string console_input; 82 | 83 | private const string INPUT_FIELD_NAME = "ifield"; 84 | private GUIStyle suggestionStyle; 85 | private GUIStyle suggestionActiveStyle; 86 | private Texture2D img_box; 87 | private StringBuilder sb = new StringBuilder(); 88 | 89 | private string greycolorstr; 90 | 91 | private struct MsgData 92 | { 93 | public string msg; 94 | public int count; 95 | 96 | public MsgData(string str) 97 | { 98 | msg = str; 99 | count = 0; 100 | } 101 | } 102 | 103 | private List msgHistory = new List(); 104 | 105 | internal ConsoleGui(ConsoleBackend backend, Options options) 106 | { 107 | skin = options.skin; 108 | 109 | greycolorstr = ConsoleUtility.ToHex(options.colors.suggestionGreyed); 110 | suggestionStyle = skin.customStyles.Where(x => x.name == "suggestion").FirstOrDefault(); 111 | suggestionActiveStyle = skin.customStyles.Where(x => x.name == "suggestionActive").FirstOrDefault(); 112 | img_box = skin.customStyles.Where(x => x.name == "img_box").FirstOrDefault().normal.background; 113 | m_backend = backend; 114 | m_options = options; 115 | 116 | m_backend.OnWriteLine += OnWriteLine; 117 | SetSize(PlayerPrefs.GetInt("beastconsole.size")); 118 | console_currentPosition = ClosedPosition; 119 | console_targetPosition = ClosedPosition; 120 | 121 | 122 | m_backend.RegisterVariable(SetSize, this, "console.size", "Set the size of the console, 1/2/3"); 123 | m_backend.RegisterCommand("clr", "clear the console log", this, Clear); 124 | } 125 | 126 | private void SetSize(int size) 127 | { 128 | consoleSize = Mathf.Clamp(size, 1, 3); 129 | PlayerPrefs.SetInt("beastconsole.size", size); 130 | } 131 | 132 | internal void Update() 133 | { 134 | rect_console = new Rect(0, 0, Screen.width, ConsoleHeight); 135 | consoleWasOpened = false; 136 | 137 | InputToggleConsole = Input.GetKeyDown(m_options.ConsoleKey); 138 | 139 | if (InputToggleConsole || GUIToggleConsole) 140 | { 141 | GUIToggleConsole = false; 142 | InputToggleConsole = false; 143 | 144 | // Do Open 145 | if (!m_consoleShown) 146 | { 147 | console_targetPosition = 0F; 148 | 149 | if (OnStateChanged != null) 150 | OnStateChanged(true); 151 | m_lerpTime = 0; 152 | m_consoleShown = true; 153 | console_input = ""; 154 | consoleWasOpened = true; 155 | 156 | ScrollToBottom(); 157 | } 158 | else 159 | { 160 | 161 | m_lerpTime = 0; 162 | 163 | console_targetPosition = ClosedPosition; 164 | 165 | m_consoleShown = false; 166 | if (OnStateChanged != null) 167 | OnStateChanged(false); 168 | } 169 | } 170 | 171 | if (m_lerpTime < m_options.TweenTime - 0.01f) 172 | { 173 | m_lerpTime += Time.deltaTime; 174 | m_lerpTime = Mathf.Clamp(m_lerpTime, 0f, m_options.TweenTime); 175 | console_currentPosition = Mathf.Lerp( 176 | console_currentPosition, 177 | console_targetPosition, 178 | Remap(m_lerpTime, 0f, m_options.TweenTime, 0f, 1f)); 179 | 180 | rect_console = new Rect(0, console_currentPosition, rect_console.width, rect_console.height); 181 | 182 | drawConsole = !Mathf.Approximately(console_currentPosition, ClosedPosition); 183 | 184 | } 185 | } 186 | 187 | internal void OnGUI() 188 | { 189 | if (!drawConsole) 190 | return; 191 | 192 | GUI.skin = skin; 193 | DrawConsole(); 194 | if (m_consoleShown) 195 | ControlInputField(); 196 | } 197 | 198 | private void DrawConsole() 199 | { 200 | GUI.Box(rect_console, "Beast console"); 201 | if (m_consoleShown) 202 | DrawHistory(); 203 | } 204 | 205 | private void ControlInputField() 206 | { 207 | Event e = Event.current; 208 | 209 | 210 | if (!consoleWasOpened && e.type == EventType.KeyDown && e.keyCode == m_options.ConsoleKey) 211 | { 212 | GUI.FocusControl(null); 213 | GUIToggleConsole = true; 214 | e.Use(); 215 | return; 216 | } 217 | 218 | if (e.type == EventType.KeyDown) 219 | { 220 | if (GUI.GetNameOfFocusedControl() == INPUT_FIELD_NAME) 221 | { 222 | if (e.keyCode == KeyCode.Return) 223 | { 224 | e.Use(); 225 | if (currentSuggestionIndex == -1) 226 | { 227 | if (!string.IsNullOrEmpty(console_input)) 228 | { 229 | try 230 | { 231 | HandleInput(console_input); 232 | } 233 | finally 234 | { 235 | console_input = ""; 236 | ScrollToBottom(); 237 | } 238 | } 239 | } 240 | else 241 | { 242 | if (!string.IsNullOrEmpty(currentSuggestion)) 243 | { 244 | try 245 | { 246 | HandleInput(currentSuggestion); 247 | } 248 | finally 249 | { 250 | currentSuggestion = null; 251 | currentSuggestionIndex = -1; 252 | console_input = ""; 253 | ScrollToBottom(); 254 | } 255 | } 256 | } 257 | } 258 | else if (e.keyCode == KeyCode.Tab) 259 | { 260 | e.Use(); 261 | if (currentSuggestionIndex == -1) 262 | { 263 | AutoComplete(console_input); 264 | moveToEnd = true; 265 | } 266 | else 267 | { 268 | console_input = currentSuggestion; 269 | moveToEnd = true; 270 | } 271 | } 272 | else if (e.keyCode == KeyCode.DownArrow) 273 | { 274 | e.Use(); 275 | if (currentCommandHistoryIndex == -1) 276 | { 277 | currentSuggestionIndex++; 278 | currentCommandHistoryIndex = -1; 279 | } 280 | else if (currentCommandHistoryIndex > -1) 281 | { 282 | currentCommandHistoryIndex--; 283 | SetCmdHistoryItem(); 284 | moveToEnd = true; 285 | } 286 | } 287 | else if (e.keyCode == KeyCode.UpArrow) 288 | { 289 | e.Use(); 290 | if (currentSuggestionIndex != -1) 291 | { 292 | currentSuggestionIndex--; 293 | currentCommandHistoryIndex = -1; 294 | } 295 | else 296 | { 297 | currentCommandHistoryIndex++; 298 | SetCmdHistoryItem(); 299 | moveToEnd = true; 300 | } 301 | } 302 | else if (e.isKey) 303 | { 304 | currentSuggestionIndex = -1; 305 | currentCommandHistoryIndex = -1; 306 | } 307 | } 308 | } 309 | 310 | 311 | DrawInputField(); 312 | DrawAutoCompleteSuggestions(console_input); 313 | 314 | if (consoleWasOpened) 315 | { 316 | GUI.FocusControl(INPUT_FIELD_NAME); 317 | } 318 | 319 | } 320 | 321 | private void SetCmdHistoryItem() 322 | { 323 | var cmdhis = m_backend.m_commandHistory; 324 | var count = cmdhis.Count; 325 | currentCommandHistoryIndex = Mathf.Clamp(currentCommandHistoryIndex, -1, count - 1); 326 | if (count == 0 || currentCommandHistoryIndex < 0) 327 | return; 328 | 329 | console_input = cmdhis[cmdhis.Count - currentCommandHistoryIndex - 1]; 330 | } 331 | 332 | private void DrawInputField() 333 | { 334 | GUI.SetNextControlName(INPUT_FIELD_NAME); 335 | Rect inputField = inputFieldRect; 336 | Vector2 size = skin.textField.CalcSize(new GUIContent(console_input)); 337 | 338 | if (inputField.width < size.x) 339 | { 340 | inputField.width = size.x + 10F; 341 | } 342 | 343 | console_input = GUI.TextField(inputField, console_input); 344 | if (moveToEnd) 345 | { 346 | TextEditor txt = (TextEditor)GUIUtility.GetStateObject(typeof(TextEditor), GUIUtility.keyboardControl); 347 | txt.text = console_input; 348 | txt.MoveLineEnd(); 349 | moveToEnd = false; 350 | } 351 | } 352 | 353 | private void OnWriteLine(string str) 354 | { 355 | int count = msgHistory.Count; 356 | if (count != 0) 357 | { 358 | var lastMsgData = msgHistory[msgHistory.Count - 1]; 359 | if (lastMsgData.msg == str) 360 | { 361 | lastMsgData.count++; 362 | msgHistory[msgHistory.Count - 1] = lastMsgData; 363 | } 364 | else 365 | { 366 | msgHistory.Add(new MsgData(str)); 367 | } 368 | } 369 | else 370 | { 371 | msgHistory.Add(new MsgData(str)); 372 | } 373 | 374 | ScrollToBottom(); 375 | } 376 | 377 | private void DrawAutoCompleteSuggestions(string str) 378 | { 379 | if (string.IsNullOrEmpty(str)) 380 | { 381 | return; 382 | } 383 | 384 | var results = m_backend.m_commandsTrie.GetByPrefix(str); 385 | var count = results.Count(); 386 | 387 | if (currentSuggestionIndex > count - 1) 388 | currentSuggestionIndex = 0; 389 | 390 | var inputrect = InputFieldBottom(); 391 | int num = 0; 392 | foreach (var item in results) 393 | { 394 | int length = ConsoleUtility.WrapInColor(greycolorstr, console_input, out string result); 395 | sb.Clear(); 396 | sb.Append(result); 397 | sb.Append(item.Value); 398 | sb.Remove(length, console_input.Length); 399 | string value = sb.ToString(); 400 | 401 | Vector2 size = suggestionStyle.CalcSize(new GUIContent(value)); 402 | Rect pos = new Rect(inputrect.x, inputrect.y + size.y * num, size.x, size.y); 403 | 404 | string description = null; 405 | if (m_backend.m_masterDictionary.TryGetValue(item.Value, out Command cmd)) 406 | { 407 | description = cmd.m_description; 408 | } 409 | 410 | if (currentSuggestionIndex == num) 411 | { 412 | currentSuggestion = item.Value; 413 | GUI.Label(pos, item.Value, suggestionActiveStyle); 414 | } 415 | else 416 | { 417 | GUI.Label(pos, value, suggestionStyle); 418 | } 419 | 420 | if (!string.IsNullOrEmpty(description)) 421 | { 422 | var descriptionSize = suggestionStyle.CalcSize(new GUIContent(description)); 423 | 424 | if (currentSuggestionIndex == num) 425 | { 426 | GUI.Label(new Rect(pos.x + pos.width + 5F, pos.y, descriptionSize.x, descriptionSize.y), description, suggestionStyle); 427 | } 428 | else 429 | { 430 | GUI.color = new Color(1, 1, 1, 0.5F); 431 | GUI.Label(new Rect(pos.x + pos.width + 5F, pos.y, descriptionSize.x, descriptionSize.y), description, suggestionStyle); 432 | GUI.color = new Color(1, 1, 1, 1); 433 | } 434 | } 435 | 436 | num++; 437 | } 438 | } 439 | 440 | private void DrawHistory() 441 | { 442 | var list = msgHistory; 443 | int count = list.Count; 444 | 445 | float totalHeight = GetHistoryContentHeight(); 446 | 447 | Rect historyRect = rect_console; 448 | 449 | Rect viewRect = new Rect(historyRect.x, historyRect.y, historyRect.width - 10, totalHeight); 450 | 451 | 452 | 453 | consoleScrollPosition = GUI.BeginScrollView(historyRect, consoleScrollPosition, viewRect); 454 | { 455 | float currentYPos = (historyRect.height > viewRect.height ? historyRect.height : viewRect.height); 456 | 457 | for (int i = count - 1; i >= 0; i--) 458 | { 459 | var msgData = list[i]; 460 | string msg = (msgData.count > 0) ? msgData.msg + " x" + msgData.count : msgData.msg; 461 | float height = CalcHeightForLine(msg); 462 | var rect = new Rect(0, currentYPos -= height, viewRect.width, height); 463 | if (i % 2 == 0) 464 | { 465 | GUI.DrawTexture(new Rect(0F, rect.y, Screen.width, rect.height), img_box); 466 | } 467 | 468 | GUI.Label(rect, msg); 469 | } 470 | } 471 | GUI.EndScrollView(); 472 | 473 | } 474 | 475 | 476 | private void ScrollToBottom() 477 | { 478 | consoleScrollPosition = new Vector2(0, GetHistoryContentHeight()); 479 | } 480 | 481 | private float CalcHeightForLine(string line) 482 | { 483 | return skin.label.CalcHeight(new GUIContent(line), Screen.width); 484 | } 485 | 486 | private Rect InputFieldBottom() 487 | { 488 | Rect rect = inputFieldRect; 489 | Vector2 size = skin.textField.CalcSize(new GUIContent(console_input)); 490 | 491 | return new Rect(rect.x, rect.y + size.y + 5F, 0, 0); 492 | } 493 | 494 | private Rect CaretPosition() 495 | { 496 | Rect rect = inputFieldRect; 497 | Vector2 size = skin.textField.CalcSize(new GUIContent(console_input)); 498 | 499 | return new Rect(rect.x + size.x, rect.y + size.y + 5F, 0, 0); 500 | } 501 | 502 | private float GetHistoryContentHeight() 503 | { 504 | float totalHeight = 0F; 505 | var list = m_backend.m_outputHistory; 506 | int count = list.Count; 507 | for (int i = 0; i < count; i++) 508 | { 509 | var cmd = list[i]; 510 | totalHeight += CalcHeightForLine(cmd); 511 | } 512 | return totalHeight; 513 | } 514 | 515 | private void HandleInput(string text) 516 | { 517 | m_backend.ExecuteLine(text); 518 | } 519 | 520 | 521 | 522 | 523 | public static Rect RectWithPadding(Rect rect, int padding) 524 | { 525 | return new Rect(rect.x + padding, rect.y + padding, rect.width - padding - padding, rect.height - padding - padding); 526 | } 527 | 528 | private float Remap(float value, float from1, float to1, float from2, float to2) 529 | { 530 | return (value - from1) / (to1 - from1) * (to2 - from2) + from2; 531 | } 532 | 533 | 534 | 535 | 536 | private void AutoComplete(string input) 537 | { 538 | string[] lookup = m_backend.CComParameterSplit(input); 539 | if (lookup.Length == 0) 540 | { 541 | // don't auto complete if we have typed any parameters so far or nothing at all... 542 | return; 543 | } 544 | Command nearestMatch = m_backend.m_masterDictionary.AutoCompleteLookup(lookup[0]); 545 | // only complete to the next dot if there is one present in the completion string which 546 | // we don't already have in the lookup string 547 | int dotIndex = 0; 548 | do 549 | { 550 | dotIndex = nearestMatch.m_name.IndexOf(".", dotIndex + 1); 551 | } 552 | while ((dotIndex > 0) && (dotIndex < lookup[0].Length)); 553 | string insertion = nearestMatch.m_name; 554 | if (dotIndex >= 0) 555 | { 556 | insertion = nearestMatch.m_name.Substring(0, dotIndex + 1); 557 | } 558 | if (insertion.Length < input.Length) 559 | { 560 | //do 561 | //{ 562 | // if (AutoCompleteTailString("true", input)) 563 | // break; 564 | // if (AutoCompleteTailString("false", input)) 565 | // break; 566 | // if (AutoCompleteTailString("True", input)) 567 | // break; 568 | // if (AutoCompleteTailString("False", input)) 569 | // break; 570 | // if (AutoCompleteTailString("TRUE", input)) 571 | // break; 572 | // if (AutoCompleteTailString("FALSE", input)) 573 | // break; 574 | //} 575 | //while (false); 576 | } 577 | else if (insertion.Length >= input.Length) // SE - is this really correct? 578 | { 579 | console_input = insertion; 580 | } 581 | if (insertion[insertion.Length - 1] != '.') 582 | console_input = insertion; 583 | } 584 | 585 | /// 586 | /// Clears out the console log 587 | /// 588 | /// 589 | /// 590 | /// SmartConsole.Clear(); 591 | /// 592 | /// 593 | internal void Clear(string[] parameters) 594 | { 595 | //we dont want to clear our history, instead we clear the screen 596 | msgHistory.Clear(); 597 | } 598 | } 599 | } -------------------------------------------------------------------------------- /Assets/BeastConsole/Gui/ConsoleGui.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d54bcca0554996b4db656bd20e000aed 3 | timeCreated: 1498847932 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/BeastConsole/Prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b5192b9703d8db64dafeb24d253eec65 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/BeastConsole/Prefab/Console.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &3683331029371837593 4 | GameObject: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | serializedVersion: 6 10 | m_Component: 11 | - component: {fileID: 3683331029371837607} 12 | - component: {fileID: 3683331029371837592} 13 | m_Layer: 0 14 | m_Name: Console 15 | m_TagString: Untagged 16 | m_Icon: {fileID: 0} 17 | m_NavMeshLayer: 0 18 | m_StaticEditorFlags: 0 19 | m_IsActive: 1 20 | --- !u!4 &3683331029371837607 21 | Transform: 22 | m_ObjectHideFlags: 0 23 | m_CorrespondingSourceObject: {fileID: 0} 24 | m_PrefabInstance: {fileID: 0} 25 | m_PrefabAsset: {fileID: 0} 26 | m_GameObject: {fileID: 3683331029371837593} 27 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 28 | m_LocalPosition: {x: 0, y: 0, z: 0} 29 | m_LocalScale: {x: 1, y: 1, z: 1} 30 | m_Children: [] 31 | m_Father: {fileID: 0} 32 | m_RootOrder: 0 33 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 34 | --- !u!114 &3683331029371837592 35 | MonoBehaviour: 36 | m_ObjectHideFlags: 0 37 | m_CorrespondingSourceObject: {fileID: 0} 38 | m_PrefabInstance: {fileID: 0} 39 | m_PrefabAsset: {fileID: 0} 40 | m_GameObject: {fileID: 3683331029371837593} 41 | m_Enabled: 1 42 | m_EditorHideFlags: 0 43 | m_Script: {fileID: 11500000, guid: 095d9b7d1ed2d6c4eaed93370f502cdc, type: 3} 44 | m_Name: 45 | m_EditorClassIdentifier: 46 | consoleOptions: 47 | ConsoleKey: 96 48 | TweenTime: 0.4 49 | MaxConsoleLines: 120 50 | LinePadding: 15 51 | LogHandler: 1 52 | skin: {fileID: 11400000, guid: cd2ed7a7916d99a489c39eca6e8cffec, type: 2} 53 | colors: 54 | error: {r: 1, g: 0.18396229, b: 0.18396229, a: 1} 55 | warning: {r: 1, g: 0.79141337, b: 0.24056602, a: 1} 56 | log: {r: 1, g: 1, b: 1, a: 1} 57 | command: {r: 0.3687876, g: 1, b: 0.0141509175, a: 1} 58 | suggestionGreyed: {r: 0.28119436, g: 0.5222857, b: 0.6698113, a: 1} 59 | -------------------------------------------------------------------------------- /Assets/BeastConsole/Prefab/Console.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 00f8cad617d2729488495d1ee824fba5 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/BeastConsole/Resources.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e0a1f580e9a21bf419fcac09a76ac82a 3 | folderAsset: yes 4 | timeCreated: 1460525658 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/BeastConsole/Resources/BeastConsole.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: aafc64771db86bd428d65a6e535d7e0d 3 | folderAsset: yes 4 | timeCreated: 1470690719 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/BeastConsole/Resources/BeastConsole/ConsoleSkin.guiskin.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cd2ed7a7916d99a489c39eca6e8cffec 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/BeastConsole/Resources/BeastConsole/Fonts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 18ad95abd537ec546a1efc26744b58d0 3 | folderAsset: yes 4 | timeCreated: 1458514524 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/BeastConsole/Resources/BeastConsole/Fonts/DejaVuSansMono-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pointcache/Unity3d-BeastConsole/5e83f9fb5e1439377deae62d0186a07d9a708999/Assets/BeastConsole/Resources/BeastConsole/Fonts/DejaVuSansMono-Bold.ttf -------------------------------------------------------------------------------- /Assets/BeastConsole/Resources/BeastConsole/Fonts/DejaVuSansMono-Bold.ttf.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 112420ca06808f645b98c0cf6d017183 3 | TrueTypeFontImporter: 4 | externalObjects: {} 5 | serializedVersion: 4 6 | fontSize: 16 7 | forceTextureCase: -2 8 | characterSpacing: 0 9 | characterPadding: 1 10 | includeFontData: 1 11 | fontName: DejaVu Sans Mono 12 | fontNames: 13 | - DejaVu Sans Mono 14 | fallbackFontReferences: 15 | - {fileID: 12800000, guid: 094201f6dace9e44cb4f6f65e72f64e1, type: 3} 16 | - {fileID: 12800000, guid: 7aeeb4e8b4bd404489802177cdd475a7, type: 3} 17 | customCharacters: 18 | fontRenderingMode: 0 19 | ascentCalculationMode: 1 20 | useLegacyBoundsCalculation: 0 21 | shouldRoundAdvanceValue: 1 22 | userData: 23 | assetBundleName: 24 | assetBundleVariant: 25 | -------------------------------------------------------------------------------- /Assets/BeastConsole/Resources/BeastConsole/Fonts/DejaVuSansMono.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pointcache/Unity3d-BeastConsole/5e83f9fb5e1439377deae62d0186a07d9a708999/Assets/BeastConsole/Resources/BeastConsole/Fonts/DejaVuSansMono.ttf -------------------------------------------------------------------------------- /Assets/BeastConsole/Resources/BeastConsole/Fonts/DejaVuSansMono.ttf.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 458c9354c373bb84b8f358a7c97ab64f 3 | TrueTypeFontImporter: 4 | externalObjects: {} 5 | serializedVersion: 4 6 | fontSize: 60 7 | forceTextureCase: -2 8 | characterSpacing: 0 9 | characterPadding: 1 10 | includeFontData: 1 11 | fontName: DejaVu Sans Mono 12 | fontNames: 13 | - DejaVu Sans Mono 14 | fallbackFontReferences: 15 | - {instanceID: 0} 16 | customCharacters: 17 | fontRenderingMode: 0 18 | ascentCalculationMode: 1 19 | useLegacyBoundsCalculation: 0 20 | shouldRoundAdvanceValue: 1 21 | userData: 22 | assetBundleName: 23 | assetBundleVariant: 24 | -------------------------------------------------------------------------------- /Assets/BeastConsole/Resources/BeastConsole/box.png: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:5d8655dbb298646f4b365e784539d323ebce7442dfc621a796c05f387dc0eabd 3 | size 1018 4 | -------------------------------------------------------------------------------- /Assets/BeastConsole/Resources/BeastConsole/box.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2af4b7279e8baae4e92e1d9afa082a99 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | externalObjects: {} 6 | serializedVersion: 7 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: 0 35 | aniso: 1 36 | mipBias: -100 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: -1 40 | nPOTScale: 0 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 1 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 1 53 | spriteTessellationDetail: -1 54 | textureType: 8 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | platformSettings: 61 | - serializedVersion: 2 62 | buildTarget: DefaultTexturePlatform 63 | maxTextureSize: 2048 64 | resizeAlgorithm: 0 65 | textureFormat: -1 66 | textureCompression: 0 67 | compressionQuality: 50 68 | crunchedCompression: 0 69 | allowsAlphaSplitting: 0 70 | overridden: 0 71 | androidETC2FallbackOverride: 0 72 | - serializedVersion: 2 73 | buildTarget: Standalone 74 | maxTextureSize: 2048 75 | resizeAlgorithm: 0 76 | textureFormat: -1 77 | textureCompression: 0 78 | compressionQuality: 50 79 | crunchedCompression: 0 80 | allowsAlphaSplitting: 0 81 | overridden: 0 82 | androidETC2FallbackOverride: 0 83 | spriteSheet: 84 | serializedVersion: 2 85 | sprites: [] 86 | outline: [] 87 | physicsShape: [] 88 | bones: [] 89 | spriteID: 90 | vertices: [] 91 | indices: 92 | edges: [] 93 | weights: [] 94 | spritePackingTag: 95 | pSDRemoveMatte: 0 96 | pSDShowRemoveMatteOption: 0 97 | userData: 98 | assetBundleName: 99 | assetBundleVariant: 100 | -------------------------------------------------------------------------------- /Assets/BeastConsole/Resources/BeastConsole/box_transparent.png: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:c3aec0f0160f0698014bb2458959a6bed127a7439e49411b49ecfa678f374146 3 | size 1018 4 | -------------------------------------------------------------------------------- /Assets/BeastConsole/Resources/BeastConsole/box_transparent.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 83368ef7151c04649b4c1707658443f8 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | externalObjects: {} 6 | serializedVersion: 7 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: 0 35 | aniso: 1 36 | mipBias: -100 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: -1 40 | nPOTScale: 0 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 1 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 1 53 | spriteTessellationDetail: -1 54 | textureType: 8 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | platformSettings: 61 | - serializedVersion: 2 62 | buildTarget: DefaultTexturePlatform 63 | maxTextureSize: 2048 64 | resizeAlgorithm: 0 65 | textureFormat: -1 66 | textureCompression: 0 67 | compressionQuality: 50 68 | crunchedCompression: 0 69 | allowsAlphaSplitting: 0 70 | overridden: 0 71 | androidETC2FallbackOverride: 0 72 | - serializedVersion: 2 73 | buildTarget: Standalone 74 | maxTextureSize: 2048 75 | resizeAlgorithm: 0 76 | textureFormat: -1 77 | textureCompression: 0 78 | compressionQuality: 50 79 | crunchedCompression: 0 80 | allowsAlphaSplitting: 0 81 | overridden: 0 82 | androidETC2FallbackOverride: 0 83 | spriteSheet: 84 | serializedVersion: 2 85 | sprites: [] 86 | outline: [] 87 | physicsShape: [] 88 | bones: [] 89 | spriteID: 90 | vertices: [] 91 | indices: 92 | edges: [] 93 | weights: [] 94 | spritePackingTag: 95 | pSDRemoveMatte: 0 96 | pSDShowRemoveMatteOption: 0 97 | userData: 98 | assetBundleName: 99 | assetBundleVariant: 100 | -------------------------------------------------------------------------------- /Assets/BeastConsole/Resources/BeastConsole/suggestion.png: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:06a41a576512a6f3f115eba1b826e551adf6440e67db92d5c5a11dd4e86973e6 3 | size 1096 4 | -------------------------------------------------------------------------------- /Assets/BeastConsole/Resources/BeastConsole/suggestion.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3b1cc08487a1f8443a63330ff4734425 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | externalObjects: {} 6 | serializedVersion: 7 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: 0 35 | aniso: 1 36 | mipBias: -100 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: -1 40 | nPOTScale: 0 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 1 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 1 53 | spriteTessellationDetail: -1 54 | textureType: 8 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | platformSettings: 61 | - serializedVersion: 2 62 | buildTarget: DefaultTexturePlatform 63 | maxTextureSize: 2048 64 | resizeAlgorithm: 0 65 | textureFormat: -1 66 | textureCompression: 0 67 | compressionQuality: 50 68 | crunchedCompression: 0 69 | allowsAlphaSplitting: 0 70 | overridden: 0 71 | androidETC2FallbackOverride: 0 72 | - serializedVersion: 2 73 | buildTarget: Standalone 74 | maxTextureSize: 2048 75 | resizeAlgorithm: 0 76 | textureFormat: -1 77 | textureCompression: 0 78 | compressionQuality: 50 79 | crunchedCompression: 0 80 | allowsAlphaSplitting: 0 81 | overridden: 0 82 | androidETC2FallbackOverride: 0 83 | spriteSheet: 84 | serializedVersion: 2 85 | sprites: [] 86 | outline: [] 87 | physicsShape: [] 88 | bones: [] 89 | spriteID: 90 | vertices: [] 91 | indices: 92 | edges: [] 93 | weights: [] 94 | spritePackingTag: 95 | pSDRemoveMatte: 0 96 | pSDShowRemoveMatteOption: 0 97 | userData: 98 | assetBundleName: 99 | assetBundleVariant: 100 | -------------------------------------------------------------------------------- /Assets/BeastConsole/Resources/BeastConsole/suggestion_active.png: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:8bc3d9c8476fa6a836aed796b53af727e1b2aecaf88669d317649bfaef9725cb 3 | size 160 4 | -------------------------------------------------------------------------------- /Assets/BeastConsole/Resources/BeastConsole/suggestion_active.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 345772eef97503c429ead8f10207dfd9 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | externalObjects: {} 6 | serializedVersion: 7 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: 0 35 | aniso: -1 36 | mipBias: -100 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: -1 40 | nPOTScale: 0 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 1 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 1 53 | spriteTessellationDetail: -1 54 | textureType: 8 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | platformSettings: 61 | - serializedVersion: 2 62 | buildTarget: DefaultTexturePlatform 63 | maxTextureSize: 2048 64 | resizeAlgorithm: 0 65 | textureFormat: -1 66 | textureCompression: 0 67 | compressionQuality: 50 68 | crunchedCompression: 0 69 | allowsAlphaSplitting: 0 70 | overridden: 0 71 | androidETC2FallbackOverride: 0 72 | - serializedVersion: 2 73 | buildTarget: Standalone 74 | maxTextureSize: 2048 75 | resizeAlgorithm: 0 76 | textureFormat: -1 77 | textureCompression: 0 78 | compressionQuality: 50 79 | crunchedCompression: 0 80 | allowsAlphaSplitting: 0 81 | overridden: 0 82 | androidETC2FallbackOverride: 0 83 | spriteSheet: 84 | serializedVersion: 2 85 | sprites: [] 86 | outline: [] 87 | physicsShape: [] 88 | bones: [] 89 | spriteID: 90 | vertices: [] 91 | indices: 92 | edges: [] 93 | weights: [] 94 | spritePackingTag: 95 | pSDRemoveMatte: 0 96 | pSDShowRemoveMatteOption: 0 97 | userData: 98 | assetBundleName: 99 | assetBundleVariant: 100 | -------------------------------------------------------------------------------- /Assets/BeastConsole/Resources/BeastConsole/textfield_focused.png: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:77454c0efa12cc64b2c0cf93223e0c52ca15dee630ee2deb3bf3f910a7f6658b 3 | size 1137 4 | -------------------------------------------------------------------------------- /Assets/BeastConsole/Resources/BeastConsole/textfield_focused.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6da92126478438046ba50c3a402d9367 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | externalObjects: {} 6 | serializedVersion: 7 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: 0 35 | aniso: -1 36 | mipBias: -100 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: -1 40 | nPOTScale: 0 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 1 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 1 53 | spriteTessellationDetail: -1 54 | textureType: 8 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | platformSettings: 61 | - serializedVersion: 2 62 | buildTarget: DefaultTexturePlatform 63 | maxTextureSize: 2048 64 | resizeAlgorithm: 0 65 | textureFormat: -1 66 | textureCompression: 0 67 | compressionQuality: 50 68 | crunchedCompression: 0 69 | allowsAlphaSplitting: 0 70 | overridden: 0 71 | androidETC2FallbackOverride: 0 72 | - serializedVersion: 2 73 | buildTarget: Standalone 74 | maxTextureSize: 2048 75 | resizeAlgorithm: 0 76 | textureFormat: -1 77 | textureCompression: 0 78 | compressionQuality: 50 79 | crunchedCompression: 0 80 | allowsAlphaSplitting: 0 81 | overridden: 0 82 | androidETC2FallbackOverride: 0 83 | spriteSheet: 84 | serializedVersion: 2 85 | sprites: [] 86 | outline: [] 87 | physicsShape: [] 88 | bones: [] 89 | spriteID: 83e5311888973014aa44fa19fe5c1093 90 | vertices: [] 91 | indices: 92 | edges: [] 93 | weights: [] 94 | spritePackingTag: 95 | pSDRemoveMatte: 0 96 | pSDShowRemoveMatteOption: 0 97 | userData: 98 | assetBundleName: 99 | assetBundleVariant: 100 | -------------------------------------------------------------------------------- /Assets/BeastConsole/SmartConsoleLicence.txt: -------------------------------------------------------------------------------- 1 | # SmartConsole 2 | 3 | A Quake style debug console for Unity with autocomplete, a command history and the ability to register custom commands and variables 4 | 5 | The implementation is broadly patterned after the debug console implementation from GLToy: https://code.google.com/p/gltoy/source/browse/trunk/GLToy/Independent/Core/Console/GLToy_Console.h 6 | 7 | This document is formatted following the conventions of Markdown to aid readability - you can use websites like http://markable.in/editor/ to view it in a more visually pleasing format than plain-text. 8 | 9 | ## Examples 10 | 11 | There is an example scene included in the package under SmartConsole/Scenes/Example.scene 12 | 13 | ## Usage 14 | 15 | The SmartConsole component should be added to an otherwise empty game object and have a font set in the inspector. For ease of use static functions are provided so that the instance need not be tracked by calling code. 16 | 17 | The console is accessed with the backtick ` key when a keyboard is available, otherwise touching or clicking the top right corner will open the console ready for input 18 | 19 | Custom commands and variables can be registered using the SmartConsole class interface described later in this document. There are some built-in commands and variables. 20 | 21 | ## Built-in Commands 22 | 23 | ### clear 24 | 25 | clear the console log 26 | 27 | ### cls 28 | 29 | clear the console log (alias for clear) 30 | 31 | ### echo 32 | 33 | writes to the console log 34 | 35 | ### help 36 | 37 | lists all console commands with their descriptions and example usage (where available) 38 | 39 | ### list 40 | 41 | lists all currently registered console variables 42 | 43 | ### print 44 | 45 | writes to the console log (alias for echo) 46 | 47 | ### quit 48 | 49 | quit the game (where possible) 50 | 51 | ### callstack.warning 52 | 53 | display the call stack for the last warning message 54 | 55 | ### callstack.error 56 | 57 | display the call stack for the last error message 58 | 59 | ### callstack.exception 60 | 61 | display the call stack for the last exception message 62 | 63 | ## Built-in Variables 64 | 65 | ### show.fps 66 | 67 | whether to draw framerate counter or not 68 | 69 | ### console.fullscreen 70 | 71 | whether to draw the console over the whole screen or not 72 | 73 | ### console.lock 74 | 75 | whether to allow showing/hiding the console 76 | 77 | ### console.log 78 | 79 | whether to redirect log to the console 80 | 81 | ## SmartConsole Class Interface 82 | 83 | the SmartConsole class provides most of the functionality in the package: 84 | 85 | ### public delegate void ConsoleCommandFunction( string parameters ) 86 | 87 | a delegate type for registering as a console command 88 | 89 | ### public static void Clear() 90 | 91 | clear the console history 92 | 93 | ### public static void Print( string message ) 94 | ### public static void WriteLine( string message ) 95 | 96 | write the message string to the debug console (only - not the log) 97 | 98 | ### public static void ExecuteLine( string inputLine ) 99 | 100 | execute a string as if entered to the console 101 | 102 | 103 | ### public static void RemoveCommandIfExists( string name ) 104 | 105 | unregister the named command, if it exists 106 | 107 | ### public static void RegisterCommand( string name, string exampleUsage, string helpDescription, ConsoleCommandFunction callback ) 108 | ### public static void RegisterCommand( string name, string helpDescription, ConsoleCommandFunction callback ) 109 | ### public static void RegisterCommand( string name, ConsoleCommandFunction callback ) 110 | 111 | register a console command with an optional example usage and help description 112 | 113 | 114 | ### public static Variable< T > CreateVariable< T >( string name, string description, T initialValue ) where T : new() 115 | ### public static Variable< T > CreateVariable< T >( string name, string description ) where T : new() 116 | ### public static Variable< T > CreateVariable< T >( string name ) where T : new() 117 | 118 | used to create a console variable e.g. 119 | 120 | SmartConsole.Variable< bool > showFPS = SmartConsole.CreateVariable< bool >( "show.fps", "whether to draw framerate counter or not", false ); 121 | 122 | ### public static void DestroyVariable< T >( Variable< T > variable ) where T : new() 123 | 124 | destroy a console variable (so its name can be reused) 125 | 126 | ## SmartConsole.Variable< T > Generic Class Interface 127 | 128 | SmartConsole.Variable< T > references are returned when using the CreateVariable function and should be kept if you want to modify or read a console variable 129 | 130 | 131 | ### public void Set( T val ) 132 | 133 | provided as a workaround to not being able to overload the assignment operator - sets the value of the console variable 134 | 135 | ### public static implicit operator T( Variable< T > var ) 136 | 137 | allows reading of a console variable in a syntactically convenient fashion e.g. 138 | 139 | float f = 0.0f; 140 | SmartConsole.Variable< float > myFloatVar = SmartConsole.CreateVariable< float >( "my.float", "an example", 1.0f ); 141 | f = myFloatVar; // f == 1.0f 142 | 143 | ## Version History 144 | 145 | ### 1.0.3 146 | - add a warning if the user pauses, makes code changes, then unpauses 147 | (it seems like this behaviour may have changed in recent Unity updates, but relying on edit-and-continue is not safe anyway!) 148 | 149 | ### 1.0.2 150 | 151 | - add this document 152 | 153 | ### 1.0 154 | 155 | - initial release 156 | - displays console on screen 157 | - redirects unity log to console 158 | - input and rendering tested with iOS and Android 159 | - command history 160 | - autocomplete 161 | - fps counter 162 | - command registration and deletion 163 | - variable registration and deletion 164 | - display call stacks in game 165 | 166 | ## Contact Us 167 | 168 | info@cranium-software.co.uk 169 | 170 | -------------------------------------------------------------------------------- /Assets/BeastConsole/SmartConsoleLicence.txt.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 272d424960e42084bbad48d0990dd7e6 3 | TextScriptImporter: 4 | userData: 5 | assetBundleName: 6 | assetBundleVariant: 7 | -------------------------------------------------------------------------------- /Assets/Example.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 16907d60bc042c94e82f19639c79bb67 3 | folderAsset: yes 4 | timeCreated: 1498850153 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Example/AttributeTest.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using BeastConsole; 4 | using UnityEngine; 5 | 6 | [ConsoleParse] 7 | public class AttributeTest : MonoBehaviour { 8 | 9 | [ConsoleVariable("testvar", "")] 10 | public float TestVariable = 5f; 11 | 12 | [ConsoleVariable("testproperty", "")] 13 | public bool TestPropertyVariable 14 | { 15 | set { 16 | Console.WriteLine("testproperty was set to: " + value); 17 | } 18 | } 19 | 20 | 21 | [ConsoleCommand("testMethod", "")] 22 | void TestMethod() { 23 | BeastConsole.Console.WriteLine("test method works"); 24 | } 25 | 26 | [ConsoleCommand("testMethodWithParams", "")] 27 | public void TestMethodWithParams(float param1) { 28 | BeastConsole.Console.WriteLine("works :" + param1.ToString()); 29 | 30 | } 31 | 32 | [ConsoleCommand("testMethodWith2Params", "")] 33 | public void TestMethodWith2Params(float param1, int param2) { 34 | BeastConsole.Console.WriteLine("works :" + (param1+ param2).ToString()); 35 | 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Assets/Example/AttributeTest.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6c2779f82e1aef444987b02a5fcd2f82 3 | timeCreated: 1499208210 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Example/AutoCompleteExmaple.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using BeastConsole; 4 | using UnityEngine; 5 | 6 | public class AutoCompleteExmaple : MonoBehaviour { 7 | 8 | // Use this for initialization 9 | void Start () { 10 | Console.AddCommand("crab","", this, null); 11 | Console.AddCommand("crusty","", this, null); 12 | Console.AddCommand("credentials","", this, null); 13 | Console.AddCommand("credentialisation","", this, null); 14 | Console.AddCommand("credentialisationed","", this, null); 15 | Console.AddCommand("credulity","", this, null); 16 | } 17 | 18 | // Update is called once per frame 19 | void Update () { 20 | 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Assets/Example/AutoCompleteExmaple.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 82a789e31ef03fa4d99f4af0a6b60ea4 3 | timeCreated: 1498947840 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Example/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ff88a0e469fc88840a9d8b532b724b51 3 | folderAsset: yes 4 | timeCreated: 1498952137 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Example/Editor/EditorTests.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using BeastConsole; 4 | using UnityEditor; 5 | using UnityEngine; 6 | 7 | public class EditorTests { 8 | 9 | [MenuItem("Test/PrintMessage")] 10 | public static void PrintTestMessage() { 11 | Console.WriteLine("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et \n dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Assets/Example/Editor/EditorTests.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 91a5964d7e6890441b559eb0f71ffa8a 3 | timeCreated: 1498951347 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Example/Example.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using BeastConsole; 4 | using UnityEngine; 5 | 6 | public class Example : MonoBehaviour { 7 | 8 | public float TestVar = 0f; 9 | 10 | // Use this for initialization 11 | void Start () { 12 | //You need to provide a setter for a variable, and a reference to "owner". 13 | Console.AddVariable("test","some test", x => TestVar = x, this ); 14 | Console.AddCommand("moveUp", "", this, MoveUp); 15 | } 16 | 17 | private void OnDestroy() { 18 | Console.RemoveVariable("test", this); 19 | Console.RemoveCommand("moveUp", this); 20 | } 21 | 22 | private void MoveUp(string[] val) { 23 | transform.position += new Vector3(0,System.Convert.ToSingle(val[1]), 0); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Assets/Example/Example.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8297bec8dce5e834eac3a434057c1619 3 | timeCreated: 1498856104 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Example/Example.unity: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!29 &1 4 | OcclusionCullingSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_OcclusionBakeSettings: 8 | smallestOccluder: 5 9 | smallestHole: 0.25 10 | backfaceThreshold: 100 11 | m_SceneGUID: 00000000000000000000000000000000 12 | m_OcclusionCullingData: {fileID: 0} 13 | --- !u!104 &2 14 | RenderSettings: 15 | m_ObjectHideFlags: 0 16 | serializedVersion: 9 17 | m_Fog: 0 18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.01 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} 24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} 25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 0 28 | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} 29 | m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} 30 | m_HaloStrength: 0.5 31 | m_FlareStrength: 1 32 | m_FlareFadeSpeed: 3 33 | m_HaloTexture: {fileID: 0} 34 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} 35 | m_DefaultReflectionMode: 0 36 | m_DefaultReflectionResolution: 128 37 | m_ReflectionBounces: 1 38 | m_ReflectionIntensity: 1 39 | m_CustomReflection: {fileID: 0} 40 | m_Sun: {fileID: 0} 41 | m_IndirectSpecularColor: {r: 0.37311953, g: 0.38074014, b: 0.3587274, a: 1} 42 | m_UseRadianceAmbientProbe: 0 43 | --- !u!157 &3 44 | LightmapSettings: 45 | m_ObjectHideFlags: 0 46 | serializedVersion: 11 47 | m_GIWorkflowMode: 0 48 | m_GISettings: 49 | serializedVersion: 2 50 | m_BounceScale: 1 51 | m_IndirectOutputScale: 1 52 | m_AlbedoBoost: 1 53 | m_EnvironmentLightingMode: 0 54 | m_EnableBakedLightmaps: 1 55 | m_EnableRealtimeLightmaps: 1 56 | m_LightmapEditorSettings: 57 | serializedVersion: 10 58 | m_Resolution: 2 59 | m_BakeResolution: 40 60 | m_AtlasSize: 1024 61 | m_AO: 0 62 | m_AOMaxDistance: 1 63 | m_CompAOExponent: 1 64 | m_CompAOExponentDirect: 0 65 | m_Padding: 2 66 | m_LightmapParameters: {fileID: 0} 67 | m_LightmapsBakeMode: 1 68 | m_TextureCompression: 1 69 | m_FinalGather: 0 70 | m_FinalGatherFiltering: 1 71 | m_FinalGatherRayCount: 256 72 | m_ReflectionCompression: 2 73 | m_MixedBakeMode: 1 74 | m_BakeBackend: 0 75 | m_PVRSampling: 1 76 | m_PVRDirectSampleCount: 32 77 | m_PVRSampleCount: 500 78 | m_PVRBounces: 2 79 | m_PVRFilterTypeDirect: 0 80 | m_PVRFilterTypeIndirect: 0 81 | m_PVRFilterTypeAO: 0 82 | m_PVRFilteringMode: 0 83 | m_PVRCulling: 1 84 | m_PVRFilteringGaussRadiusDirect: 1 85 | m_PVRFilteringGaussRadiusIndirect: 5 86 | m_PVRFilteringGaussRadiusAO: 2 87 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 88 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 89 | m_PVRFilteringAtrousPositionSigmaAO: 1 90 | m_ShowResolutionOverlay: 1 91 | m_LightingDataAsset: {fileID: 0} 92 | m_UseShadowmask: 0 93 | --- !u!196 &4 94 | NavMeshSettings: 95 | serializedVersion: 2 96 | m_ObjectHideFlags: 0 97 | m_BuildSettings: 98 | serializedVersion: 2 99 | agentTypeID: 0 100 | agentRadius: 0.5 101 | agentHeight: 2 102 | agentSlope: 45 103 | agentClimb: 0.4 104 | ledgeDropHeight: 0 105 | maxJumpAcrossDistance: 0 106 | minRegionArea: 2 107 | manualCellSize: 0 108 | cellSize: 0.16666667 109 | manualTileSize: 0 110 | tileSize: 256 111 | accuratePlacement: 0 112 | debug: 113 | m_Flags: 0 114 | m_NavMeshData: {fileID: 0} 115 | --- !u!1 &138943635 116 | GameObject: 117 | m_ObjectHideFlags: 0 118 | m_CorrespondingSourceObject: {fileID: 0} 119 | m_PrefabInstance: {fileID: 0} 120 | m_PrefabAsset: {fileID: 0} 121 | serializedVersion: 6 122 | m_Component: 123 | - component: {fileID: 138943636} 124 | - component: {fileID: 138943637} 125 | m_Layer: 0 126 | m_Name: ExampleConfigManual 127 | m_TagString: Untagged 128 | m_Icon: {fileID: 0} 129 | m_NavMeshLayer: 0 130 | m_StaticEditorFlags: 0 131 | m_IsActive: 1 132 | --- !u!4 &138943636 133 | Transform: 134 | m_ObjectHideFlags: 0 135 | m_CorrespondingSourceObject: {fileID: 0} 136 | m_PrefabInstance: {fileID: 0} 137 | m_PrefabAsset: {fileID: 0} 138 | m_GameObject: {fileID: 138943635} 139 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 140 | m_LocalPosition: {x: -0.24426079, y: -0.042539597, z: -0.43522072} 141 | m_LocalScale: {x: 1, y: 1, z: 1} 142 | m_Children: [] 143 | m_Father: {fileID: 0} 144 | m_RootOrder: 10 145 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 146 | --- !u!114 &138943637 147 | MonoBehaviour: 148 | m_ObjectHideFlags: 0 149 | m_CorrespondingSourceObject: {fileID: 0} 150 | m_PrefabInstance: {fileID: 0} 151 | m_PrefabAsset: {fileID: 0} 152 | m_GameObject: {fileID: 138943635} 153 | m_Enabled: 1 154 | m_EditorHideFlags: 0 155 | m_Script: {fileID: 11500000, guid: d0e68f52dd7c8424eb6652c83bbe7fac, type: 3} 156 | m_Name: 157 | m_EditorClassIdentifier: 158 | Volume: 1 159 | Vsync: 0 160 | FrameLimit: 60 161 | --- !u!1 &500584591 162 | GameObject: 163 | m_ObjectHideFlags: 0 164 | m_CorrespondingSourceObject: {fileID: 0} 165 | m_PrefabInstance: {fileID: 0} 166 | m_PrefabAsset: {fileID: 0} 167 | serializedVersion: 6 168 | m_Component: 169 | - component: {fileID: 500584593} 170 | m_Layer: 0 171 | m_Name: EditorTests 172 | m_TagString: Untagged 173 | m_Icon: {fileID: 0} 174 | m_NavMeshLayer: 0 175 | m_StaticEditorFlags: 0 176 | m_IsActive: 1 177 | --- !u!4 &500584593 178 | Transform: 179 | m_ObjectHideFlags: 0 180 | m_CorrespondingSourceObject: {fileID: 0} 181 | m_PrefabInstance: {fileID: 0} 182 | m_PrefabAsset: {fileID: 0} 183 | m_GameObject: {fileID: 500584591} 184 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 185 | m_LocalPosition: {x: -0.5, y: 337.7, z: 0} 186 | m_LocalScale: {x: 1, y: 1, z: 1} 187 | m_Children: [] 188 | m_Father: {fileID: 0} 189 | m_RootOrder: 13 190 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 191 | --- !u!1 &640852401 192 | GameObject: 193 | m_ObjectHideFlags: 0 194 | m_CorrespondingSourceObject: {fileID: 0} 195 | m_PrefabInstance: {fileID: 0} 196 | m_PrefabAsset: {fileID: 0} 197 | serializedVersion: 6 198 | m_Component: 199 | - component: {fileID: 640852403} 200 | - component: {fileID: 640852402} 201 | m_Layer: 0 202 | m_Name: Example 203 | m_TagString: Untagged 204 | m_Icon: {fileID: 0} 205 | m_NavMeshLayer: 0 206 | m_StaticEditorFlags: 0 207 | m_IsActive: 1 208 | --- !u!114 &640852402 209 | MonoBehaviour: 210 | m_ObjectHideFlags: 0 211 | m_CorrespondingSourceObject: {fileID: 0} 212 | m_PrefabInstance: {fileID: 0} 213 | m_PrefabAsset: {fileID: 0} 214 | m_GameObject: {fileID: 640852401} 215 | m_Enabled: 1 216 | m_EditorHideFlags: 0 217 | m_Script: {fileID: 11500000, guid: 8297bec8dce5e834eac3a434057c1619, type: 3} 218 | m_Name: 219 | m_EditorClassIdentifier: 220 | TestVar: 0 221 | --- !u!4 &640852403 222 | Transform: 223 | m_ObjectHideFlags: 0 224 | m_CorrespondingSourceObject: {fileID: 0} 225 | m_PrefabInstance: {fileID: 0} 226 | m_PrefabAsset: {fileID: 0} 227 | m_GameObject: {fileID: 640852401} 228 | m_LocalRotation: {x: -0, y: -0.66519284, z: -0, w: 0.7466717} 229 | m_LocalPosition: {x: 4.240972, y: 0, z: -3.1617258} 230 | m_LocalScale: {x: 1, y: 1, z: 1} 231 | m_Children: 232 | - {fileID: 1498864594} 233 | m_Father: {fileID: 0} 234 | m_RootOrder: 4 235 | m_LocalEulerAnglesHint: {x: 0, y: -83.394005, z: 0} 236 | --- !u!1 &742161054 237 | GameObject: 238 | m_ObjectHideFlags: 0 239 | m_CorrespondingSourceObject: {fileID: 0} 240 | m_PrefabInstance: {fileID: 0} 241 | m_PrefabAsset: {fileID: 0} 242 | serializedVersion: 6 243 | m_Component: 244 | - component: {fileID: 742161056} 245 | - component: {fileID: 742161055} 246 | m_Layer: 0 247 | m_Name: Console 248 | m_TagString: Untagged 249 | m_Icon: {fileID: 0} 250 | m_NavMeshLayer: 0 251 | m_StaticEditorFlags: 0 252 | m_IsActive: 1 253 | --- !u!114 &742161055 254 | MonoBehaviour: 255 | m_ObjectHideFlags: 0 256 | m_CorrespondingSourceObject: {fileID: 0} 257 | m_PrefabInstance: {fileID: 0} 258 | m_PrefabAsset: {fileID: 0} 259 | m_GameObject: {fileID: 742161054} 260 | m_Enabled: 1 261 | m_EditorHideFlags: 0 262 | m_Script: {fileID: 11500000, guid: 095d9b7d1ed2d6c4eaed93370f502cdc, type: 3} 263 | m_Name: 264 | m_EditorClassIdentifier: 265 | consoleOptions: 266 | ConsoleKey: 96 267 | TweenTime: 0.4 268 | MaxConsoleLines: 120 269 | LinePadding: 15 270 | LogHandler: 1 271 | skin: {fileID: 11400000, guid: cd2ed7a7916d99a489c39eca6e8cffec, type: 2} 272 | colors: 273 | error: {r: 1, g: 0.18396229, b: 0.18396229, a: 1} 274 | warning: {r: 1, g: 0.79141337, b: 0.24056602, a: 1} 275 | log: {r: 1, g: 1, b: 1, a: 1} 276 | command: {r: 0.3687876, g: 1, b: 0.0141509175, a: 1} 277 | suggestionGreyed: {r: 0.28119436, g: 0.5222857, b: 0.6698113, a: 1} 278 | --- !u!4 &742161056 279 | Transform: 280 | m_ObjectHideFlags: 0 281 | m_CorrespondingSourceObject: {fileID: 0} 282 | m_PrefabInstance: {fileID: 0} 283 | m_PrefabAsset: {fileID: 0} 284 | m_GameObject: {fileID: 742161054} 285 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 286 | m_LocalPosition: {x: 0, y: 0, z: 0} 287 | m_LocalScale: {x: 1, y: 1, z: 1} 288 | m_Children: [] 289 | m_Father: {fileID: 0} 290 | m_RootOrder: 2 291 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 292 | --- !u!1 &798840753 293 | GameObject: 294 | m_ObjectHideFlags: 0 295 | m_CorrespondingSourceObject: {fileID: 0} 296 | m_PrefabInstance: {fileID: 0} 297 | m_PrefabAsset: {fileID: 0} 298 | serializedVersion: 6 299 | m_Component: 300 | - component: {fileID: 798840754} 301 | - component: {fileID: 798840757} 302 | - component: {fileID: 798840756} 303 | - component: {fileID: 798840755} 304 | m_Layer: 0 305 | m_Name: Cube 306 | m_TagString: Untagged 307 | m_Icon: {fileID: 0} 308 | m_NavMeshLayer: 0 309 | m_StaticEditorFlags: 0 310 | m_IsActive: 1 311 | --- !u!4 &798840754 312 | Transform: 313 | m_ObjectHideFlags: 0 314 | m_CorrespondingSourceObject: {fileID: 0} 315 | m_PrefabInstance: {fileID: 0} 316 | m_PrefabAsset: {fileID: 0} 317 | m_GameObject: {fileID: 798840753} 318 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 319 | m_LocalPosition: {x: 0, y: 0, z: 0} 320 | m_LocalScale: {x: 1, y: 1, z: 1} 321 | m_Children: [] 322 | m_Father: {fileID: 1576380580} 323 | m_RootOrder: 0 324 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 325 | --- !u!23 &798840755 326 | MeshRenderer: 327 | m_ObjectHideFlags: 0 328 | m_CorrespondingSourceObject: {fileID: 0} 329 | m_PrefabInstance: {fileID: 0} 330 | m_PrefabAsset: {fileID: 0} 331 | m_GameObject: {fileID: 798840753} 332 | m_Enabled: 1 333 | m_CastShadows: 1 334 | m_ReceiveShadows: 1 335 | m_DynamicOccludee: 1 336 | m_MotionVectors: 1 337 | m_LightProbeUsage: 1 338 | m_ReflectionProbeUsage: 1 339 | m_RenderingLayerMask: 1 340 | m_RendererPriority: 0 341 | m_Materials: 342 | - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} 343 | m_StaticBatchInfo: 344 | firstSubMesh: 0 345 | subMeshCount: 0 346 | m_StaticBatchRoot: {fileID: 0} 347 | m_ProbeAnchor: {fileID: 0} 348 | m_LightProbeVolumeOverride: {fileID: 0} 349 | m_ScaleInLightmap: 1 350 | m_PreserveUVs: 1 351 | m_IgnoreNormalsForChartDetection: 0 352 | m_ImportantGI: 0 353 | m_StitchLightmapSeams: 0 354 | m_SelectedEditorRenderState: 3 355 | m_MinimumChartSize: 4 356 | m_AutoUVMaxDistance: 0.5 357 | m_AutoUVMaxAngle: 89 358 | m_LightmapParameters: {fileID: 0} 359 | m_SortingLayerID: 0 360 | m_SortingLayer: 0 361 | m_SortingOrder: 0 362 | --- !u!65 &798840756 363 | BoxCollider: 364 | m_ObjectHideFlags: 0 365 | m_CorrespondingSourceObject: {fileID: 0} 366 | m_PrefabInstance: {fileID: 0} 367 | m_PrefabAsset: {fileID: 0} 368 | m_GameObject: {fileID: 798840753} 369 | m_Material: {fileID: 0} 370 | m_IsTrigger: 0 371 | m_Enabled: 1 372 | serializedVersion: 2 373 | m_Size: {x: 1, y: 1, z: 1} 374 | m_Center: {x: 0, y: 0, z: 0} 375 | --- !u!33 &798840757 376 | MeshFilter: 377 | m_ObjectHideFlags: 0 378 | m_CorrespondingSourceObject: {fileID: 0} 379 | m_PrefabInstance: {fileID: 0} 380 | m_PrefabAsset: {fileID: 0} 381 | m_GameObject: {fileID: 798840753} 382 | m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} 383 | --- !u!1 &830340143 384 | GameObject: 385 | m_ObjectHideFlags: 0 386 | m_CorrespondingSourceObject: {fileID: 0} 387 | m_PrefabInstance: {fileID: 0} 388 | m_PrefabAsset: {fileID: 0} 389 | serializedVersion: 6 390 | m_Component: 391 | - component: {fileID: 830340145} 392 | - component: {fileID: 830340144} 393 | m_Layer: 0 394 | m_Name: Example 395 | m_TagString: Untagged 396 | m_Icon: {fileID: 0} 397 | m_NavMeshLayer: 0 398 | m_StaticEditorFlags: 0 399 | m_IsActive: 1 400 | --- !u!114 &830340144 401 | MonoBehaviour: 402 | m_ObjectHideFlags: 0 403 | m_CorrespondingSourceObject: {fileID: 0} 404 | m_PrefabInstance: {fileID: 0} 405 | m_PrefabAsset: {fileID: 0} 406 | m_GameObject: {fileID: 830340143} 407 | m_Enabled: 1 408 | m_EditorHideFlags: 0 409 | m_Script: {fileID: 11500000, guid: 8297bec8dce5e834eac3a434057c1619, type: 3} 410 | m_Name: 411 | m_EditorClassIdentifier: 412 | TestVar: 0 413 | --- !u!4 &830340145 414 | Transform: 415 | m_ObjectHideFlags: 0 416 | m_CorrespondingSourceObject: {fileID: 0} 417 | m_PrefabInstance: {fileID: 0} 418 | m_PrefabAsset: {fileID: 0} 419 | m_GameObject: {fileID: 830340143} 420 | m_LocalRotation: {x: -0, y: -0.66519284, z: -0, w: 0.7466717} 421 | m_LocalPosition: {x: -2.118499, y: 0, z: 1.6918447} 422 | m_LocalScale: {x: 1, y: 1, z: 1} 423 | m_Children: 424 | - {fileID: 1961979220} 425 | m_Father: {fileID: 0} 426 | m_RootOrder: 6 427 | m_LocalEulerAnglesHint: {x: 0, y: -83.394005, z: 0} 428 | --- !u!1 &889133964 429 | GameObject: 430 | m_ObjectHideFlags: 0 431 | m_CorrespondingSourceObject: {fileID: 0} 432 | m_PrefabInstance: {fileID: 0} 433 | m_PrefabAsset: {fileID: 0} 434 | serializedVersion: 6 435 | m_Component: 436 | - component: {fileID: 889133966} 437 | - component: {fileID: 889133965} 438 | m_Layer: 0 439 | m_Name: ExampleConfigAttribute 440 | m_TagString: Untagged 441 | m_Icon: {fileID: 0} 442 | m_NavMeshLayer: 0 443 | m_StaticEditorFlags: 0 444 | m_IsActive: 1 445 | --- !u!114 &889133965 446 | MonoBehaviour: 447 | m_ObjectHideFlags: 0 448 | m_CorrespondingSourceObject: {fileID: 0} 449 | m_PrefabInstance: {fileID: 0} 450 | m_PrefabAsset: {fileID: 0} 451 | m_GameObject: {fileID: 889133964} 452 | m_Enabled: 1 453 | m_EditorHideFlags: 0 454 | m_Script: {fileID: 11500000, guid: 46329ecaae090e242954b4fce5d18ddf, type: 3} 455 | m_Name: 456 | m_EditorClassIdentifier: 457 | PlayerMoney: 10000 458 | --- !u!4 &889133966 459 | Transform: 460 | m_ObjectHideFlags: 0 461 | m_CorrespondingSourceObject: {fileID: 0} 462 | m_PrefabInstance: {fileID: 0} 463 | m_PrefabAsset: {fileID: 0} 464 | m_GameObject: {fileID: 889133964} 465 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 466 | m_LocalPosition: {x: -0.24426079, y: -0.042539597, z: -0.43522072} 467 | m_LocalScale: {x: 1, y: 1, z: 1} 468 | m_Children: [] 469 | m_Father: {fileID: 0} 470 | m_RootOrder: 9 471 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 472 | --- !u!1 &905813468 473 | GameObject: 474 | m_ObjectHideFlags: 0 475 | m_CorrespondingSourceObject: {fileID: 0} 476 | m_PrefabInstance: {fileID: 0} 477 | m_PrefabAsset: {fileID: 0} 478 | serializedVersion: 6 479 | m_Component: 480 | - component: {fileID: 905813471} 481 | - component: {fileID: 905813470} 482 | - component: {fileID: 905813469} 483 | m_Layer: 0 484 | m_Name: EventSystem 485 | m_TagString: Untagged 486 | m_Icon: {fileID: 0} 487 | m_NavMeshLayer: 0 488 | m_StaticEditorFlags: 0 489 | m_IsActive: 1 490 | --- !u!114 &905813469 491 | MonoBehaviour: 492 | m_ObjectHideFlags: 0 493 | m_CorrespondingSourceObject: {fileID: 0} 494 | m_PrefabInstance: {fileID: 0} 495 | m_PrefabAsset: {fileID: 0} 496 | m_GameObject: {fileID: 905813468} 497 | m_Enabled: 1 498 | m_EditorHideFlags: 0 499 | m_Script: {fileID: 1077351063, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} 500 | m_Name: 501 | m_EditorClassIdentifier: 502 | m_HorizontalAxis: Horizontal 503 | m_VerticalAxis: Vertical 504 | m_SubmitButton: Submit 505 | m_CancelButton: Cancel 506 | m_InputActionsPerSecond: 10 507 | m_RepeatDelay: 0.5 508 | m_ForceModuleActive: 0 509 | --- !u!114 &905813470 510 | MonoBehaviour: 511 | m_ObjectHideFlags: 0 512 | m_CorrespondingSourceObject: {fileID: 0} 513 | m_PrefabInstance: {fileID: 0} 514 | m_PrefabAsset: {fileID: 0} 515 | m_GameObject: {fileID: 905813468} 516 | m_Enabled: 1 517 | m_EditorHideFlags: 0 518 | m_Script: {fileID: -619905303, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} 519 | m_Name: 520 | m_EditorClassIdentifier: 521 | m_FirstSelected: {fileID: 0} 522 | m_sendNavigationEvents: 1 523 | m_DragThreshold: 5 524 | --- !u!4 &905813471 525 | Transform: 526 | m_ObjectHideFlags: 0 527 | m_CorrespondingSourceObject: {fileID: 0} 528 | m_PrefabInstance: {fileID: 0} 529 | m_PrefabAsset: {fileID: 0} 530 | m_GameObject: {fileID: 905813468} 531 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 532 | m_LocalPosition: {x: 0, y: 0, z: 0} 533 | m_LocalScale: {x: 1, y: 1, z: 1} 534 | m_Children: [] 535 | m_Father: {fileID: 0} 536 | m_RootOrder: 1 537 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 538 | --- !u!1 &919166490 539 | GameObject: 540 | m_ObjectHideFlags: 0 541 | m_CorrespondingSourceObject: {fileID: 0} 542 | m_PrefabInstance: {fileID: 0} 543 | m_PrefabAsset: {fileID: 0} 544 | serializedVersion: 6 545 | m_Component: 546 | - component: {fileID: 919166491} 547 | - component: {fileID: 919166492} 548 | m_Layer: 0 549 | m_Name: MultilineExample 550 | m_TagString: Untagged 551 | m_Icon: {fileID: 0} 552 | m_NavMeshLayer: 0 553 | m_StaticEditorFlags: 0 554 | m_IsActive: 1 555 | --- !u!4 &919166491 556 | Transform: 557 | m_ObjectHideFlags: 0 558 | m_CorrespondingSourceObject: {fileID: 0} 559 | m_PrefabInstance: {fileID: 0} 560 | m_PrefabAsset: {fileID: 0} 561 | m_GameObject: {fileID: 919166490} 562 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 563 | m_LocalPosition: {x: 0, y: 0, z: 0} 564 | m_LocalScale: {x: 1, y: 1, z: 1} 565 | m_Children: [] 566 | m_Father: {fileID: 0} 567 | m_RootOrder: 11 568 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 569 | --- !u!114 &919166492 570 | MonoBehaviour: 571 | m_ObjectHideFlags: 0 572 | m_CorrespondingSourceObject: {fileID: 0} 573 | m_PrefabInstance: {fileID: 0} 574 | m_PrefabAsset: {fileID: 0} 575 | m_GameObject: {fileID: 919166490} 576 | m_Enabled: 1 577 | m_EditorHideFlags: 0 578 | m_Script: {fileID: 11500000, guid: ba6f64b074968e8429f1a809d66ed0f6, type: 3} 579 | m_Name: 580 | m_EditorClassIdentifier: 581 | --- !u!1 &1131395841 582 | GameObject: 583 | m_ObjectHideFlags: 0 584 | m_CorrespondingSourceObject: {fileID: 0} 585 | m_PrefabInstance: {fileID: 0} 586 | m_PrefabAsset: {fileID: 0} 587 | serializedVersion: 6 588 | m_Component: 589 | - component: {fileID: 1131395843} 590 | - component: {fileID: 1131395842} 591 | m_Layer: 0 592 | m_Name: Example 593 | m_TagString: Untagged 594 | m_Icon: {fileID: 0} 595 | m_NavMeshLayer: 0 596 | m_StaticEditorFlags: 0 597 | m_IsActive: 1 598 | --- !u!114 &1131395842 599 | MonoBehaviour: 600 | m_ObjectHideFlags: 0 601 | m_CorrespondingSourceObject: {fileID: 0} 602 | m_PrefabInstance: {fileID: 0} 603 | m_PrefabAsset: {fileID: 0} 604 | m_GameObject: {fileID: 1131395841} 605 | m_Enabled: 1 606 | m_EditorHideFlags: 0 607 | m_Script: {fileID: 11500000, guid: 8297bec8dce5e834eac3a434057c1619, type: 3} 608 | m_Name: 609 | m_EditorClassIdentifier: 610 | TestVar: 0 611 | --- !u!4 &1131395843 612 | Transform: 613 | m_ObjectHideFlags: 0 614 | m_CorrespondingSourceObject: {fileID: 0} 615 | m_PrefabInstance: {fileID: 0} 616 | m_PrefabAsset: {fileID: 0} 617 | m_GameObject: {fileID: 1131395841} 618 | m_LocalRotation: {x: -0, y: -0.66519284, z: -0, w: 0.7466717} 619 | m_LocalPosition: {x: 2.3641331, y: 0, z: -1.7293152} 620 | m_LocalScale: {x: 1, y: 1, z: 1} 621 | m_Children: 622 | - {fileID: 1420612295} 623 | m_Father: {fileID: 0} 624 | m_RootOrder: 7 625 | m_LocalEulerAnglesHint: {x: 0, y: -83.394005, z: 0} 626 | --- !u!1 &1257793407 627 | GameObject: 628 | m_ObjectHideFlags: 0 629 | m_CorrespondingSourceObject: {fileID: 0} 630 | m_PrefabInstance: {fileID: 0} 631 | m_PrefabAsset: {fileID: 0} 632 | serializedVersion: 6 633 | m_Component: 634 | - component: {fileID: 1257793409} 635 | - component: {fileID: 1257793408} 636 | m_Layer: 0 637 | m_Name: Example 638 | m_TagString: Untagged 639 | m_Icon: {fileID: 0} 640 | m_NavMeshLayer: 0 641 | m_StaticEditorFlags: 0 642 | m_IsActive: 1 643 | --- !u!114 &1257793408 644 | MonoBehaviour: 645 | m_ObjectHideFlags: 0 646 | m_CorrespondingSourceObject: {fileID: 0} 647 | m_PrefabInstance: {fileID: 0} 648 | m_PrefabAsset: {fileID: 0} 649 | m_GameObject: {fileID: 1257793407} 650 | m_Enabled: 1 651 | m_EditorHideFlags: 0 652 | m_Script: {fileID: 11500000, guid: 8297bec8dce5e834eac3a434057c1619, type: 3} 653 | m_Name: 654 | m_EditorClassIdentifier: 655 | TestVar: 0 656 | --- !u!4 &1257793409 657 | Transform: 658 | m_ObjectHideFlags: 0 659 | m_CorrespondingSourceObject: {fileID: 0} 660 | m_PrefabInstance: {fileID: 0} 661 | m_PrefabAsset: {fileID: 0} 662 | m_GameObject: {fileID: 1257793407} 663 | m_LocalRotation: {x: -0, y: -0.66519284, z: -0, w: 0.7466717} 664 | m_LocalPosition: {x: -4.240972, y: 0, z: 3.3117254} 665 | m_LocalScale: {x: 1, y: 1, z: 1} 666 | m_Children: 667 | - {fileID: 2029037061} 668 | m_Father: {fileID: 0} 669 | m_RootOrder: 5 670 | m_LocalEulerAnglesHint: {x: 0, y: -83.394005, z: 0} 671 | --- !u!1 &1308598958 672 | GameObject: 673 | m_ObjectHideFlags: 0 674 | m_CorrespondingSourceObject: {fileID: 0} 675 | m_PrefabInstance: {fileID: 0} 676 | m_PrefabAsset: {fileID: 0} 677 | serializedVersion: 6 678 | m_Component: 679 | - component: {fileID: 1308598963} 680 | - component: {fileID: 1308598962} 681 | - component: {fileID: 1308598961} 682 | - component: {fileID: 1308598960} 683 | - component: {fileID: 1308598959} 684 | m_Layer: 0 685 | m_Name: Main Camera 686 | m_TagString: MainCamera 687 | m_Icon: {fileID: 0} 688 | m_NavMeshLayer: 0 689 | m_StaticEditorFlags: 0 690 | m_IsActive: 1 691 | --- !u!81 &1308598959 692 | AudioListener: 693 | m_ObjectHideFlags: 0 694 | m_CorrespondingSourceObject: {fileID: 0} 695 | m_PrefabInstance: {fileID: 0} 696 | m_PrefabAsset: {fileID: 0} 697 | m_GameObject: {fileID: 1308598958} 698 | m_Enabled: 1 699 | --- !u!124 &1308598960 700 | Behaviour: 701 | m_ObjectHideFlags: 0 702 | m_CorrespondingSourceObject: {fileID: 0} 703 | m_PrefabInstance: {fileID: 0} 704 | m_PrefabAsset: {fileID: 0} 705 | m_GameObject: {fileID: 1308598958} 706 | m_Enabled: 1 707 | --- !u!92 &1308598961 708 | Behaviour: 709 | m_ObjectHideFlags: 0 710 | m_CorrespondingSourceObject: {fileID: 0} 711 | m_PrefabInstance: {fileID: 0} 712 | m_PrefabAsset: {fileID: 0} 713 | m_GameObject: {fileID: 1308598958} 714 | m_Enabled: 1 715 | --- !u!20 &1308598962 716 | Camera: 717 | m_ObjectHideFlags: 0 718 | m_CorrespondingSourceObject: {fileID: 0} 719 | m_PrefabInstance: {fileID: 0} 720 | m_PrefabAsset: {fileID: 0} 721 | m_GameObject: {fileID: 1308598958} 722 | m_Enabled: 1 723 | serializedVersion: 2 724 | m_ClearFlags: 2 725 | m_BackGroundColor: {r: 0.23010379, g: 0.3290777, b: 0.41176468, a: 0} 726 | m_projectionMatrixMode: 1 727 | m_SensorSize: {x: 36, y: 24} 728 | m_LensShift: {x: 0, y: 0} 729 | m_GateFitMode: 2 730 | m_FocalLength: 50 731 | m_NormalizedViewPortRect: 732 | serializedVersion: 2 733 | x: 0 734 | y: 0 735 | width: 1 736 | height: 1 737 | near clip plane: 0.3 738 | far clip plane: 1000 739 | field of view: 60 740 | orthographic: 0 741 | orthographic size: 5 742 | m_Depth: -1 743 | m_CullingMask: 744 | serializedVersion: 2 745 | m_Bits: 4294967295 746 | m_RenderingPath: -1 747 | m_TargetTexture: {fileID: 0} 748 | m_TargetDisplay: 0 749 | m_TargetEye: 3 750 | m_HDR: 0 751 | m_AllowMSAA: 1 752 | m_AllowDynamicResolution: 0 753 | m_ForceIntoRT: 0 754 | m_OcclusionCulling: 1 755 | m_StereoConvergence: 10 756 | m_StereoSeparation: 0.022 757 | --- !u!4 &1308598963 758 | Transform: 759 | m_ObjectHideFlags: 0 760 | m_CorrespondingSourceObject: {fileID: 0} 761 | m_PrefabInstance: {fileID: 0} 762 | m_PrefabAsset: {fileID: 0} 763 | m_GameObject: {fileID: 1308598958} 764 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 765 | m_LocalPosition: {x: 0, y: 1, z: -10} 766 | m_LocalScale: {x: 1, y: 1, z: 1} 767 | m_Children: [] 768 | m_Father: {fileID: 0} 769 | m_RootOrder: 0 770 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 771 | --- !u!1 &1420612294 772 | GameObject: 773 | m_ObjectHideFlags: 0 774 | m_CorrespondingSourceObject: {fileID: 0} 775 | m_PrefabInstance: {fileID: 0} 776 | m_PrefabAsset: {fileID: 0} 777 | serializedVersion: 6 778 | m_Component: 779 | - component: {fileID: 1420612295} 780 | - component: {fileID: 1420612298} 781 | - component: {fileID: 1420612297} 782 | - component: {fileID: 1420612296} 783 | m_Layer: 0 784 | m_Name: Cube 785 | m_TagString: Untagged 786 | m_Icon: {fileID: 0} 787 | m_NavMeshLayer: 0 788 | m_StaticEditorFlags: 0 789 | m_IsActive: 1 790 | --- !u!4 &1420612295 791 | Transform: 792 | m_ObjectHideFlags: 0 793 | m_CorrespondingSourceObject: {fileID: 0} 794 | m_PrefabInstance: {fileID: 0} 795 | m_PrefabAsset: {fileID: 0} 796 | m_GameObject: {fileID: 1420612294} 797 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 798 | m_LocalPosition: {x: 0, y: 0, z: 0} 799 | m_LocalScale: {x: 1, y: 1, z: 1} 800 | m_Children: [] 801 | m_Father: {fileID: 1131395843} 802 | m_RootOrder: 0 803 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 804 | --- !u!23 &1420612296 805 | MeshRenderer: 806 | m_ObjectHideFlags: 0 807 | m_CorrespondingSourceObject: {fileID: 0} 808 | m_PrefabInstance: {fileID: 0} 809 | m_PrefabAsset: {fileID: 0} 810 | m_GameObject: {fileID: 1420612294} 811 | m_Enabled: 1 812 | m_CastShadows: 1 813 | m_ReceiveShadows: 1 814 | m_DynamicOccludee: 1 815 | m_MotionVectors: 1 816 | m_LightProbeUsage: 1 817 | m_ReflectionProbeUsage: 1 818 | m_RenderingLayerMask: 1 819 | m_RendererPriority: 0 820 | m_Materials: 821 | - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} 822 | m_StaticBatchInfo: 823 | firstSubMesh: 0 824 | subMeshCount: 0 825 | m_StaticBatchRoot: {fileID: 0} 826 | m_ProbeAnchor: {fileID: 0} 827 | m_LightProbeVolumeOverride: {fileID: 0} 828 | m_ScaleInLightmap: 1 829 | m_PreserveUVs: 1 830 | m_IgnoreNormalsForChartDetection: 0 831 | m_ImportantGI: 0 832 | m_StitchLightmapSeams: 0 833 | m_SelectedEditorRenderState: 3 834 | m_MinimumChartSize: 4 835 | m_AutoUVMaxDistance: 0.5 836 | m_AutoUVMaxAngle: 89 837 | m_LightmapParameters: {fileID: 0} 838 | m_SortingLayerID: 0 839 | m_SortingLayer: 0 840 | m_SortingOrder: 0 841 | --- !u!65 &1420612297 842 | BoxCollider: 843 | m_ObjectHideFlags: 0 844 | m_CorrespondingSourceObject: {fileID: 0} 845 | m_PrefabInstance: {fileID: 0} 846 | m_PrefabAsset: {fileID: 0} 847 | m_GameObject: {fileID: 1420612294} 848 | m_Material: {fileID: 0} 849 | m_IsTrigger: 0 850 | m_Enabled: 1 851 | serializedVersion: 2 852 | m_Size: {x: 1, y: 1, z: 1} 853 | m_Center: {x: 0, y: 0, z: 0} 854 | --- !u!33 &1420612298 855 | MeshFilter: 856 | m_ObjectHideFlags: 0 857 | m_CorrespondingSourceObject: {fileID: 0} 858 | m_PrefabInstance: {fileID: 0} 859 | m_PrefabAsset: {fileID: 0} 860 | m_GameObject: {fileID: 1420612294} 861 | m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} 862 | --- !u!1 &1498864593 863 | GameObject: 864 | m_ObjectHideFlags: 0 865 | m_CorrespondingSourceObject: {fileID: 0} 866 | m_PrefabInstance: {fileID: 0} 867 | m_PrefabAsset: {fileID: 0} 868 | serializedVersion: 6 869 | m_Component: 870 | - component: {fileID: 1498864594} 871 | - component: {fileID: 1498864597} 872 | - component: {fileID: 1498864596} 873 | - component: {fileID: 1498864595} 874 | m_Layer: 0 875 | m_Name: Cube 876 | m_TagString: Untagged 877 | m_Icon: {fileID: 0} 878 | m_NavMeshLayer: 0 879 | m_StaticEditorFlags: 0 880 | m_IsActive: 1 881 | --- !u!4 &1498864594 882 | Transform: 883 | m_ObjectHideFlags: 0 884 | m_CorrespondingSourceObject: {fileID: 0} 885 | m_PrefabInstance: {fileID: 0} 886 | m_PrefabAsset: {fileID: 0} 887 | m_GameObject: {fileID: 1498864593} 888 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 889 | m_LocalPosition: {x: 0, y: 0, z: 0} 890 | m_LocalScale: {x: 1, y: 1, z: 1} 891 | m_Children: [] 892 | m_Father: {fileID: 640852403} 893 | m_RootOrder: 0 894 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 895 | --- !u!23 &1498864595 896 | MeshRenderer: 897 | m_ObjectHideFlags: 0 898 | m_CorrespondingSourceObject: {fileID: 0} 899 | m_PrefabInstance: {fileID: 0} 900 | m_PrefabAsset: {fileID: 0} 901 | m_GameObject: {fileID: 1498864593} 902 | m_Enabled: 1 903 | m_CastShadows: 1 904 | m_ReceiveShadows: 1 905 | m_DynamicOccludee: 1 906 | m_MotionVectors: 1 907 | m_LightProbeUsage: 1 908 | m_ReflectionProbeUsage: 1 909 | m_RenderingLayerMask: 1 910 | m_RendererPriority: 0 911 | m_Materials: 912 | - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} 913 | m_StaticBatchInfo: 914 | firstSubMesh: 0 915 | subMeshCount: 0 916 | m_StaticBatchRoot: {fileID: 0} 917 | m_ProbeAnchor: {fileID: 0} 918 | m_LightProbeVolumeOverride: {fileID: 0} 919 | m_ScaleInLightmap: 1 920 | m_PreserveUVs: 1 921 | m_IgnoreNormalsForChartDetection: 0 922 | m_ImportantGI: 0 923 | m_StitchLightmapSeams: 0 924 | m_SelectedEditorRenderState: 3 925 | m_MinimumChartSize: 4 926 | m_AutoUVMaxDistance: 0.5 927 | m_AutoUVMaxAngle: 89 928 | m_LightmapParameters: {fileID: 0} 929 | m_SortingLayerID: 0 930 | m_SortingLayer: 0 931 | m_SortingOrder: 0 932 | --- !u!65 &1498864596 933 | BoxCollider: 934 | m_ObjectHideFlags: 0 935 | m_CorrespondingSourceObject: {fileID: 0} 936 | m_PrefabInstance: {fileID: 0} 937 | m_PrefabAsset: {fileID: 0} 938 | m_GameObject: {fileID: 1498864593} 939 | m_Material: {fileID: 0} 940 | m_IsTrigger: 0 941 | m_Enabled: 1 942 | serializedVersion: 2 943 | m_Size: {x: 1, y: 1, z: 1} 944 | m_Center: {x: 0, y: 0, z: 0} 945 | --- !u!33 &1498864597 946 | MeshFilter: 947 | m_ObjectHideFlags: 0 948 | m_CorrespondingSourceObject: {fileID: 0} 949 | m_PrefabInstance: {fileID: 0} 950 | m_PrefabAsset: {fileID: 0} 951 | m_GameObject: {fileID: 1498864593} 952 | m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} 953 | --- !u!1 &1576380578 954 | GameObject: 955 | m_ObjectHideFlags: 0 956 | m_CorrespondingSourceObject: {fileID: 0} 957 | m_PrefabInstance: {fileID: 0} 958 | m_PrefabAsset: {fileID: 0} 959 | serializedVersion: 6 960 | m_Component: 961 | - component: {fileID: 1576380580} 962 | - component: {fileID: 1576380579} 963 | m_Layer: 0 964 | m_Name: Example 965 | m_TagString: Untagged 966 | m_Icon: {fileID: 0} 967 | m_NavMeshLayer: 0 968 | m_StaticEditorFlags: 0 969 | m_IsActive: 1 970 | --- !u!114 &1576380579 971 | MonoBehaviour: 972 | m_ObjectHideFlags: 0 973 | m_CorrespondingSourceObject: {fileID: 0} 974 | m_PrefabInstance: {fileID: 0} 975 | m_PrefabAsset: {fileID: 0} 976 | m_GameObject: {fileID: 1576380578} 977 | m_Enabled: 1 978 | m_EditorHideFlags: 0 979 | m_Script: {fileID: 11500000, guid: 8297bec8dce5e834eac3a434057c1619, type: 3} 980 | m_Name: 981 | m_EditorClassIdentifier: 982 | TestVar: 0 983 | --- !u!4 &1576380580 984 | Transform: 985 | m_ObjectHideFlags: 0 986 | m_CorrespondingSourceObject: {fileID: 0} 987 | m_PrefabInstance: {fileID: 0} 988 | m_PrefabAsset: {fileID: 0} 989 | m_GameObject: {fileID: 1576380578} 990 | m_LocalRotation: {x: -0, y: -0.66519284, z: -0, w: 0.7466717} 991 | m_LocalPosition: {x: 0.059619863, y: 0, z: 0.029497724} 992 | m_LocalScale: {x: 1, y: 1, z: 1} 993 | m_Children: 994 | - {fileID: 798840754} 995 | m_Father: {fileID: 0} 996 | m_RootOrder: 3 997 | m_LocalEulerAnglesHint: {x: 0, y: -83.394005, z: 0} 998 | --- !u!1 &1841755445 999 | GameObject: 1000 | m_ObjectHideFlags: 0 1001 | m_CorrespondingSourceObject: {fileID: 0} 1002 | m_PrefabInstance: {fileID: 0} 1003 | m_PrefabAsset: {fileID: 0} 1004 | serializedVersion: 6 1005 | m_Component: 1006 | - component: {fileID: 1841755447} 1007 | - component: {fileID: 1841755446} 1008 | m_Layer: 0 1009 | m_Name: AutoCompleteExample 1010 | m_TagString: Untagged 1011 | m_Icon: {fileID: 0} 1012 | m_NavMeshLayer: 0 1013 | m_StaticEditorFlags: 0 1014 | m_IsActive: 1 1015 | --- !u!114 &1841755446 1016 | MonoBehaviour: 1017 | m_ObjectHideFlags: 0 1018 | m_CorrespondingSourceObject: {fileID: 0} 1019 | m_PrefabInstance: {fileID: 0} 1020 | m_PrefabAsset: {fileID: 0} 1021 | m_GameObject: {fileID: 1841755445} 1022 | m_Enabled: 1 1023 | m_EditorHideFlags: 0 1024 | m_Script: {fileID: 11500000, guid: 82a789e31ef03fa4d99f4af0a6b60ea4, type: 3} 1025 | m_Name: 1026 | m_EditorClassIdentifier: 1027 | --- !u!4 &1841755447 1028 | Transform: 1029 | m_ObjectHideFlags: 0 1030 | m_CorrespondingSourceObject: {fileID: 0} 1031 | m_PrefabInstance: {fileID: 0} 1032 | m_PrefabAsset: {fileID: 0} 1033 | m_GameObject: {fileID: 1841755445} 1034 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 1035 | m_LocalPosition: {x: 99.238914, y: 3319.9055, z: 134.86266} 1036 | m_LocalScale: {x: 1, y: 1, z: 1} 1037 | m_Children: [] 1038 | m_Father: {fileID: 0} 1039 | m_RootOrder: 12 1040 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 1041 | --- !u!1 &1961979219 1042 | GameObject: 1043 | m_ObjectHideFlags: 0 1044 | m_CorrespondingSourceObject: {fileID: 0} 1045 | m_PrefabInstance: {fileID: 0} 1046 | m_PrefabAsset: {fileID: 0} 1047 | serializedVersion: 6 1048 | m_Component: 1049 | - component: {fileID: 1961979220} 1050 | - component: {fileID: 1961979223} 1051 | - component: {fileID: 1961979222} 1052 | - component: {fileID: 1961979221} 1053 | m_Layer: 0 1054 | m_Name: Cube 1055 | m_TagString: Untagged 1056 | m_Icon: {fileID: 0} 1057 | m_NavMeshLayer: 0 1058 | m_StaticEditorFlags: 0 1059 | m_IsActive: 1 1060 | --- !u!4 &1961979220 1061 | Transform: 1062 | m_ObjectHideFlags: 0 1063 | m_CorrespondingSourceObject: {fileID: 0} 1064 | m_PrefabInstance: {fileID: 0} 1065 | m_PrefabAsset: {fileID: 0} 1066 | m_GameObject: {fileID: 1961979219} 1067 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 1068 | m_LocalPosition: {x: 0, y: 0, z: 0} 1069 | m_LocalScale: {x: 1, y: 1, z: 1} 1070 | m_Children: [] 1071 | m_Father: {fileID: 830340145} 1072 | m_RootOrder: 0 1073 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 1074 | --- !u!23 &1961979221 1075 | MeshRenderer: 1076 | m_ObjectHideFlags: 0 1077 | m_CorrespondingSourceObject: {fileID: 0} 1078 | m_PrefabInstance: {fileID: 0} 1079 | m_PrefabAsset: {fileID: 0} 1080 | m_GameObject: {fileID: 1961979219} 1081 | m_Enabled: 1 1082 | m_CastShadows: 1 1083 | m_ReceiveShadows: 1 1084 | m_DynamicOccludee: 1 1085 | m_MotionVectors: 1 1086 | m_LightProbeUsage: 1 1087 | m_ReflectionProbeUsage: 1 1088 | m_RenderingLayerMask: 1 1089 | m_RendererPriority: 0 1090 | m_Materials: 1091 | - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} 1092 | m_StaticBatchInfo: 1093 | firstSubMesh: 0 1094 | subMeshCount: 0 1095 | m_StaticBatchRoot: {fileID: 0} 1096 | m_ProbeAnchor: {fileID: 0} 1097 | m_LightProbeVolumeOverride: {fileID: 0} 1098 | m_ScaleInLightmap: 1 1099 | m_PreserveUVs: 1 1100 | m_IgnoreNormalsForChartDetection: 0 1101 | m_ImportantGI: 0 1102 | m_StitchLightmapSeams: 0 1103 | m_SelectedEditorRenderState: 3 1104 | m_MinimumChartSize: 4 1105 | m_AutoUVMaxDistance: 0.5 1106 | m_AutoUVMaxAngle: 89 1107 | m_LightmapParameters: {fileID: 0} 1108 | m_SortingLayerID: 0 1109 | m_SortingLayer: 0 1110 | m_SortingOrder: 0 1111 | --- !u!65 &1961979222 1112 | BoxCollider: 1113 | m_ObjectHideFlags: 0 1114 | m_CorrespondingSourceObject: {fileID: 0} 1115 | m_PrefabInstance: {fileID: 0} 1116 | m_PrefabAsset: {fileID: 0} 1117 | m_GameObject: {fileID: 1961979219} 1118 | m_Material: {fileID: 0} 1119 | m_IsTrigger: 0 1120 | m_Enabled: 1 1121 | serializedVersion: 2 1122 | m_Size: {x: 1, y: 1, z: 1} 1123 | m_Center: {x: 0, y: 0, z: 0} 1124 | --- !u!33 &1961979223 1125 | MeshFilter: 1126 | m_ObjectHideFlags: 0 1127 | m_CorrespondingSourceObject: {fileID: 0} 1128 | m_PrefabInstance: {fileID: 0} 1129 | m_PrefabAsset: {fileID: 0} 1130 | m_GameObject: {fileID: 1961979219} 1131 | m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} 1132 | --- !u!1 &2029037060 1133 | GameObject: 1134 | m_ObjectHideFlags: 0 1135 | m_CorrespondingSourceObject: {fileID: 0} 1136 | m_PrefabInstance: {fileID: 0} 1137 | m_PrefabAsset: {fileID: 0} 1138 | serializedVersion: 6 1139 | m_Component: 1140 | - component: {fileID: 2029037061} 1141 | - component: {fileID: 2029037064} 1142 | - component: {fileID: 2029037063} 1143 | - component: {fileID: 2029037062} 1144 | m_Layer: 0 1145 | m_Name: Cube 1146 | m_TagString: Untagged 1147 | m_Icon: {fileID: 0} 1148 | m_NavMeshLayer: 0 1149 | m_StaticEditorFlags: 0 1150 | m_IsActive: 1 1151 | --- !u!4 &2029037061 1152 | Transform: 1153 | m_ObjectHideFlags: 0 1154 | m_CorrespondingSourceObject: {fileID: 0} 1155 | m_PrefabInstance: {fileID: 0} 1156 | m_PrefabAsset: {fileID: 0} 1157 | m_GameObject: {fileID: 2029037060} 1158 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 1159 | m_LocalPosition: {x: 0, y: 0, z: 0} 1160 | m_LocalScale: {x: 1, y: 1, z: 1} 1161 | m_Children: [] 1162 | m_Father: {fileID: 1257793409} 1163 | m_RootOrder: 0 1164 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 1165 | --- !u!23 &2029037062 1166 | MeshRenderer: 1167 | m_ObjectHideFlags: 0 1168 | m_CorrespondingSourceObject: {fileID: 0} 1169 | m_PrefabInstance: {fileID: 0} 1170 | m_PrefabAsset: {fileID: 0} 1171 | m_GameObject: {fileID: 2029037060} 1172 | m_Enabled: 1 1173 | m_CastShadows: 1 1174 | m_ReceiveShadows: 1 1175 | m_DynamicOccludee: 1 1176 | m_MotionVectors: 1 1177 | m_LightProbeUsage: 1 1178 | m_ReflectionProbeUsage: 1 1179 | m_RenderingLayerMask: 1 1180 | m_RendererPriority: 0 1181 | m_Materials: 1182 | - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} 1183 | m_StaticBatchInfo: 1184 | firstSubMesh: 0 1185 | subMeshCount: 0 1186 | m_StaticBatchRoot: {fileID: 0} 1187 | m_ProbeAnchor: {fileID: 0} 1188 | m_LightProbeVolumeOverride: {fileID: 0} 1189 | m_ScaleInLightmap: 1 1190 | m_PreserveUVs: 1 1191 | m_IgnoreNormalsForChartDetection: 0 1192 | m_ImportantGI: 0 1193 | m_StitchLightmapSeams: 0 1194 | m_SelectedEditorRenderState: 3 1195 | m_MinimumChartSize: 4 1196 | m_AutoUVMaxDistance: 0.5 1197 | m_AutoUVMaxAngle: 89 1198 | m_LightmapParameters: {fileID: 0} 1199 | m_SortingLayerID: 0 1200 | m_SortingLayer: 0 1201 | m_SortingOrder: 0 1202 | --- !u!65 &2029037063 1203 | BoxCollider: 1204 | m_ObjectHideFlags: 0 1205 | m_CorrespondingSourceObject: {fileID: 0} 1206 | m_PrefabInstance: {fileID: 0} 1207 | m_PrefabAsset: {fileID: 0} 1208 | m_GameObject: {fileID: 2029037060} 1209 | m_Material: {fileID: 0} 1210 | m_IsTrigger: 0 1211 | m_Enabled: 1 1212 | serializedVersion: 2 1213 | m_Size: {x: 1, y: 1, z: 1} 1214 | m_Center: {x: 0, y: 0, z: 0} 1215 | --- !u!33 &2029037064 1216 | MeshFilter: 1217 | m_ObjectHideFlags: 0 1218 | m_CorrespondingSourceObject: {fileID: 0} 1219 | m_PrefabInstance: {fileID: 0} 1220 | m_PrefabAsset: {fileID: 0} 1221 | m_GameObject: {fileID: 2029037060} 1222 | m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} 1223 | --- !u!1 &2111665034 1224 | GameObject: 1225 | m_ObjectHideFlags: 0 1226 | m_CorrespondingSourceObject: {fileID: 0} 1227 | m_PrefabInstance: {fileID: 0} 1228 | m_PrefabAsset: {fileID: 0} 1229 | serializedVersion: 6 1230 | m_Component: 1231 | - component: {fileID: 2111665036} 1232 | - component: {fileID: 2111665035} 1233 | m_Layer: 0 1234 | m_Name: AttributeTest 1235 | m_TagString: Untagged 1236 | m_Icon: {fileID: 0} 1237 | m_NavMeshLayer: 0 1238 | m_StaticEditorFlags: 0 1239 | m_IsActive: 1 1240 | --- !u!114 &2111665035 1241 | MonoBehaviour: 1242 | m_ObjectHideFlags: 0 1243 | m_CorrespondingSourceObject: {fileID: 0} 1244 | m_PrefabInstance: {fileID: 0} 1245 | m_PrefabAsset: {fileID: 0} 1246 | m_GameObject: {fileID: 2111665034} 1247 | m_Enabled: 1 1248 | m_EditorHideFlags: 0 1249 | m_Script: {fileID: 11500000, guid: 6c2779f82e1aef444987b02a5fcd2f82, type: 3} 1250 | m_Name: 1251 | m_EditorClassIdentifier: 1252 | TestVariable: 5 1253 | --- !u!4 &2111665036 1254 | Transform: 1255 | m_ObjectHideFlags: 0 1256 | m_CorrespondingSourceObject: {fileID: 0} 1257 | m_PrefabInstance: {fileID: 0} 1258 | m_PrefabAsset: {fileID: 0} 1259 | m_GameObject: {fileID: 2111665034} 1260 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 1261 | m_LocalPosition: {x: 0, y: 0, z: 0} 1262 | m_LocalScale: {x: 1, y: 1, z: 1} 1263 | m_Children: [] 1264 | m_Father: {fileID: 0} 1265 | m_RootOrder: 8 1266 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 1267 | -------------------------------------------------------------------------------- /Assets/Example/Example.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1495125ff575bc14a97df2af901c3dc1 3 | timeCreated: 1498850153 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Example/ExampleConfigAttribute.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System; 3 | using System.Collections.Generic; 4 | using BeastConsole; 5 | 6 | public class ExampleConfigAttribute : MonoBehaviour { 7 | 8 | [ConsoleVariable("player.money", "How much money player has")] 9 | public float PlayerMoney = 10000f; 10 | 11 | private int _playerPhysicsLayer; 12 | [ConsoleVariable("player.physicsLayer")] 13 | public int PlayerPhysicsLayer 14 | { 15 | set { 16 | BeastConsole.Console.WriteLine("Player Physics Layer was set to : " + value); 17 | _playerPhysicsLayer = value; 18 | } 19 | get { 20 | return _playerPhysicsLayer; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Assets/Example/ExampleConfigAttribute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 46329ecaae090e242954b4fce5d18ddf 3 | timeCreated: 1499229427 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Example/ExampleConfigManual.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using BeastConsole; 4 | using UnityEngine; 5 | 6 | 7 | /// 8 | /// This example is made by manually registering console variables. Most of the time you would want to 9 | /// use an attribute but sometimes you would need a manual method (for example for registering 10 | /// non monobehaviors. 11 | /// 12 | public class ExampleConfigManual : MonoBehaviour { 13 | 14 | public float Volume = 1f; 15 | public bool Vsync = false; 16 | public int FrameLimit = 60; 17 | 18 | private void Awake() { 19 | //Simple setter 20 | Console.AddVariable("volume", "", x => Volume = x, this); 21 | 22 | //Lambda 23 | Console.AddVariable("vsync", "", x=> 24 | { 25 | Vsync = x; 26 | QualitySettings.vSyncCount = x ? 1 : 0; 27 | }, this); 28 | 29 | //Method 30 | Console.AddVariable("frameLimit", "", SetFramerate, this); 31 | } 32 | 33 | private void OnDestroy() { 34 | Console.RemoveVariable("volume", this); 35 | Console.RemoveVariable("vsync", this); 36 | Console.RemoveVariable("frameLimit", this); 37 | 38 | } 39 | 40 | void SetFramerate(int val) { 41 | FrameLimit = val; 42 | Application.targetFrameRate = FrameLimit; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Assets/Example/ExampleConfigManual.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d0e68f52dd7c8424eb6652c83bbe7fac 3 | timeCreated: 1498863258 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Example/MultilineExample.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using BeastConsole; 4 | using UnityEngine; 5 | 6 | public class MultilineExample : MonoBehaviour { 7 | 8 | // Use this for initialization 9 | void Start () { 10 | Console.WriteLine("Welcome to BeastConsole Example. This is and example of a multiline message. \n" + 11 | "- Backend is created by folks at CraniumSoftware. \n" + 12 | "- Register your own arbitrary commands/methods and provide parameters \n" + 13 | "- Autocomplete \n" + 14 | "- Add variables \n" + 15 | "- Both commands and variables support any number of subscribers, modify all objects at once."); 16 | } 17 | 18 | 19 | } 20 | -------------------------------------------------------------------------------- /Assets/Example/MultilineExample.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ba6f64b074968e8429f1a809d66ed0f6 3 | timeCreated: 1498945700 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | BEAST CONSOLE 2 | 3 | Project is released under MIT license Copyright (c) 2016 Alexander Antonov (pointcache) and contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | 11 | 12 | SMART CONSOLE (substantial portion of this project) LICENSE 13 | 14 | Copyright (c) 2014-2016 Cranium Software 15 | 16 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and 17 | associated documentation files ("SmartConsole"), to deal in SmartConsole without restriction, 18 | including without limitation the rights to use, copy, modify, merge, publish, distribute, 19 | sublicense, and/or sell copies of SmartConsole, and to permit persons to whom SmartConsole is 20 | furnished to do so, subject to the following conditions: 21 | 22 | (1) The above copyright notice and this permission notice shall be included in all copies or 23 | substantial portions of SmartConsole, including but not limited to redistribution in binary 24 | form. 25 | 26 | (2) Except as contained in this notice, the name(s) of the above copyright holders shall not be 27 | used in advertising or otherwise to promote the sale, use or other dealings in SmartConsole 28 | without prior written authorization. 29 | 30 | SMARTCONSOLE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 31 | NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 32 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 33 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT 34 | OF OR IN CONNECTION WITH SMARTCONSOLE OR THE USE OR OTHER DEALINGS IN SMARTCONSOLE. 35 | -------------------------------------------------------------------------------- /Packages/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.unity.ads": "2.0.8", 4 | "com.unity.analytics": "3.2.2", 5 | "com.unity.collab-proxy": "1.2.15", 6 | "com.unity.package-manager-ui": "2.0.3", 7 | "com.unity.purchasing": "2.0.3", 8 | "com.unity.textmeshpro": "1.3.0", 9 | "com.unity.modules.ai": "1.0.0", 10 | "com.unity.modules.animation": "1.0.0", 11 | "com.unity.modules.assetbundle": "1.0.0", 12 | "com.unity.modules.audio": "1.0.0", 13 | "com.unity.modules.cloth": "1.0.0", 14 | "com.unity.modules.director": "1.0.0", 15 | "com.unity.modules.imageconversion": "1.0.0", 16 | "com.unity.modules.imgui": "1.0.0", 17 | "com.unity.modules.jsonserialize": "1.0.0", 18 | "com.unity.modules.particlesystem": "1.0.0", 19 | "com.unity.modules.physics": "1.0.0", 20 | "com.unity.modules.physics2d": "1.0.0", 21 | "com.unity.modules.screencapture": "1.0.0", 22 | "com.unity.modules.terrain": "1.0.0", 23 | "com.unity.modules.terrainphysics": "1.0.0", 24 | "com.unity.modules.tilemap": "1.0.0", 25 | "com.unity.modules.ui": "1.0.0", 26 | "com.unity.modules.uielements": "1.0.0", 27 | "com.unity.modules.umbra": "1.0.0", 28 | "com.unity.modules.unityanalytics": "1.0.0", 29 | "com.unity.modules.unitywebrequest": "1.0.0", 30 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 31 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 32 | "com.unity.modules.unitywebrequesttexture": "1.0.0", 33 | "com.unity.modules.unitywebrequestwww": "1.0.0", 34 | "com.unity.modules.vehicles": "1.0.0", 35 | "com.unity.modules.video": "1.0.0", 36 | "com.unity.modules.vr": "1.0.0", 37 | "com.unity.modules.wind": "1.0.0", 38 | "com.unity.modules.xr": "1.0.0" 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | ![License MIT](https://img.shields.io/badge/license-MIT-green.svg) 3 | 4 | # Beast Console 5 | 6 | ![screen](https://i.imgur.com/HwZk4ZJ.jpg) 7 | 8 | 9 | ## Recently updated to remove any trace of UGUI. Now its pure IMGUI, with no additional clutter. 10 | 11 | This project is possible because of the effort of amazing people at Cranium Software 12 | this project is based of SmartConsole https://github.com/CraniumSoftware/SmartConsole 13 | 14 | BeastConsole is evolution (hopefully) of SmartConsole, 15 | 16 | 17 | # Console 18 | * Backend is created by folks at CraniumSoftware. 19 | * Use attributes to bind members 20 | * Register your own arbitrary commands/methods for any object(non monob as well) and provide parameters 21 | * Autocomplete 22 | * Both commands and variables support any number of subscribers, modify all objects at once. 23 | * Multiline 24 | * Suggestions 25 | * History 26 | * ConsoleUtility class containing methods to draw tables. (You can actually use ConsoleUtility pretty much by itself instead of Console class). 27 | 28 | # Usage 29 | 30 | setup: 31 | Drop Console prefab in scene, change parameters to your liking. 32 | 33 | Attributes: 34 | 35 | Console uses reflection to find attributes, to speed up the whole process we should mark any class that has uses console 36 | attributes with `[ConsoleParse]` attribute. 37 | 38 | ```csharp 39 | 40 | [ConsoleParse] 41 | public class AttributeTest : MonoBehaviour { 42 | 43 | [ConsoleVariable("testvar", "")] 44 | public float TestVariable = 5f; 45 | 46 | [ConsoleVariable("testproperty", "")] 47 | public bool TestPropertyVariable 48 | { 49 | set { 50 | Console.WriteLine("testproperty was set to: " + value); 51 | } 52 | } 53 | 54 | 55 | [ConsoleCommand("testMethod", "")] 56 | void TestMethod() { 57 | BeastConsole.Console.WriteLine("test method works"); 58 | } 59 | 60 | [ConsoleCommand("testMethodWithParams", "")] 61 | public void TestMethodWithParams(float param1) { 62 | BeastConsole.Console.WriteLine("works :" + param1.ToString()); 63 | 64 | } 65 | 66 | [ConsoleCommand("testMethodWith2Params", "")] 67 | public void TestMethodWith2Params(float param1, int param2) { 68 | BeastConsole.Console.WriteLine("works :" + (param1+ param2).ToString()); 69 | 70 | } 71 | } 72 | 73 | 74 | ``` 75 | 76 | Manual: 77 | 78 | ```csharp 79 | 80 | public float Volume = 1f; 81 | Console.RegisterVariable("Volume", "", x => Volume = x, this); 82 | 83 | Console.RegisterCommand("MoveUp", "", this, MoveUp); 84 | 85 | private void MoveUp(string[] val) { 86 | transform.position += new Vector3(0, System.Convert.ToSingle(val[1]) , 0); 87 | } 88 | 89 | ``` 90 | Manual method requires you to unregister commands and variables when done with an object. 91 | 92 | See Example folder for more examples. 93 | 94 | --------------------------------------------------------------------------------