private void Awake() { global::Tweaker.Core.LogManager.Set(new LogManager()); logger = global::Tweaker.Core.LogManager.GetCurrentClassLogger(); logger.Info("Logger initialized"); tweaker = new Tweaker(); Scanner scanner = new Scanner(); ScanOptions scanOptions = new ScanOptions(); scanOptions.Assemblies.ScannableRefs = new Assembly[1] { typeof(TweakerConsoleTestbed).Assembly }; TweakerOptions tweakerOptions = new TweakerOptions(); tweakerOptions.Flags = TweakerOptionFlags.ScanForInvokables | TweakerOptionFlags.ScanForTweakables | TweakerOptionFlags.ScanForWatchables | TweakerOptionFlags.DoNotAutoScan | TweakerOptionFlags.IncludeTests; tweaker.Init(tweakerOptions, scanner); TweakerSerializer serializer = new TweakerSerializer(tweaker.Scanner); tweaker.Scanner.Scan(scanOptions); console = Object.Instantiate(ConsolePrefab); logger.Info("console instatiated: " + console); console.GetComponent <RectTransform>().SetParent(GetComponent <RectTransform>(), worldPositionStays: false); logger.Info("console parented to testbed canvas"); console.Init(tweaker, serializer); }
private IEnumerator Start() { IScanner scanner = new Scanner(); tweaker = new Tweaker(); TweakerOptions options = TweakerOptions.GetDefaultWithAdditionalFlags(TweakerOptionFlags.IncludeTests); tweaker.Init(options, scanner); AutoTweakable.Manager = tweaker.Tweakables; new TestClass(disposeTweakable: false); ITweakable tweakable = tweaker.Tweakables.GetTweakable(new SearchOptions("TestClass.AutoInt#")); IntegrationTest.Assert(tweakable != null); uint counter = 0u; while (tweaker.Tweakables.GetTweakable(new SearchOptions("TestClass.AutoInt#")) != null) { GC.Collect(); counter++; if (counter > 1000) { IntegrationTest.Fail("Failed to finalize AutoTweakable after " + counter + " frames."); yield break; } yield return(null); } IntegrationTest.Pass(); }