void Start() { var vmin = Mathf.Min(Screen.width, Screen.height); var ratio = vmin / 4096f; resolutionSlider.value = Mathf.Log10(ratio * ratio); cameraDistance = Mathf.Pow(10f, cameraDistanceSlider.value); strength = Mathf.Pow(10f, strengthSlider.value); attenuation = Mathf.Pow(10f, attenuationSlider.value); resolutionRatio = Mathf.Pow(10f, resolutionSlider.value); ChangeResolution(); Application.targetFrameRate = 1000; frameTimeWatcher = new Kayac.FrameTimeWatcher(); mode = Mode.HeightExp; heightExpButton.color = Color.green; materials = new Material[shaders.Length]; for (int i = 0; i < shaders.Length; i++) { materials[i] = new Material(shaders[i]); } SetMaterial(); }
public FrameTimeGauge( float width, float height, FrameTimeWatcher watcher) : base(0f, 66.667f, width, height, asInteger: true) { if (watcher == null) { _watcher = new FrameTimeWatcher(); _watcherIsMine = true; } else { _watcher = watcher; } }
void Start() { // 設定。環境に合わせていじっていい _cachePath = Application.dataPath; #if !UNITY_EDITOR && UNITY_STANDALONE_OSX _cachePath += "/../.."; //MACはContentsの外まで戻す #else _cachePath += "/.."; //Assetの横でいい #endif _cachePath += "/AssetBundleCache"; var metaDataJson = File.ReadAllText(Application.streamingAssetsPath + "/assetbundle_metadata.json"); var metaDataContainer = JsonUtility.FromJson <Kayac.AssetBundleMetaDataContainer>(metaDataJson); _metaData = metaDataContainer.items; _shuffledMetaData = new Kayac.AssetBundleMetaData[_metaData.Length]; Array.Copy(_metaData, _shuffledMetaData, _metaData.Length); Shuffle(_shuffledMetaData); #if false // 単純FileIO。最速なので、書き込み側オーバーヘッドの測定に用いる。 _root = "file://" + Application.dataPath + "/../AssetBundleBuild/"; #elif false // ローカルからのダウンロード。一応httpを経由させたい範囲で速度が欲しい時、簡易的に用いる。 _root = "http://localhost/~hirayama-takashi/AssetBundlePerformanceTestData/"; #else // 遠隔からのダウンロード。準備が必要。 _root = "https://hiryma.github.io/AssetBundlePerformanceTestData/"; #endif // 落とすサーバとファイルリストを上書き try { var customListPath = Application.streamingAssetsPath + "/list.txt"; if (System.IO.File.Exists(customListPath)) { var file = new StreamReader(customListPath); _root = file.ReadLine(); // 1行目がサーバ。例えばhttp://localhost/~hirayama-takashi/hoge/" var tmpList = new List <string>(); while (!file.EndOfStream) // 2行目以降がassetBundleファイル名 { var line = file.ReadLine(); if (!string.IsNullOrEmpty(line)) { tmpList.Add(line + ".unity3d"); // リストに拡張子がついてるなら、あるいは拡張子なしなら抜いてください } } _metaData = new Kayac.AssetBundleMetaData[tmpList.Count]; for (int i = 0; i < tmpList.Count; i++) { _metaData[i].name = tmpList[i]; _metaData[i].hash = null; _metaData[i].size = 0; // 不明 } } } catch { } // 以下は初期化実コード _log = new Kayac.FileLogHandler("log.txt"); _appendLog = new Kayac.FileLogHandler("appendLog.txt", append: true); _modeDropdown.ClearOptions(); var modeNames = System.Enum.GetNames(typeof(Mode)); foreach (var mode in modeNames) { var option = new Dropdown.OptionData(); option.text = mode; _modeDropdown.options.Add(option); } _modeDropdown.value = 0; _modeDropdown.captionText.text = modeNames[0]; _frametimeWatcher = new Kayac.FrameTimeWatcher(); }
public SampleWindow(DebugUiManager manager) : base(manager, "SampleWindow") { _frameTimeWatcher = new FrameTimeWatcher(); var button = new DebugUiButton("ボタン", 100f); button.onClick = () => { _log.Add("ボタンが押された!"); }; AddAuto(button); var toggleGroup = new DebugUiToggleGroup(); var toggles = new DebugUiToggle[2]; toggles[0] = new DebugUiToggle("トグルA", 100f, 50f, toggleGroup); toggles[0].onChangeToOn = () => { _log.Add("Aが有効になった"); }; AddAuto(toggles[0]); toggles[1] = new DebugUiToggle("トグルB", 100f, 50f, toggleGroup); toggles[1].onChangeToOn = () => { _log.Add("Bが有効になった"); }; AddAuto(toggles[1]); var text = new DebugUiText("テキスト", fontSize: 20f, width: 80f, height: 25f); AddAuto(text); BreakLine(); _log = new DebugUiLogWindow( fontSize: 20f, width: 600f, height: 220f, borderEnabled: true, captureUnityLog: true); // Unityのログも出しちゃうよ AddAuto(_log); _graph = new DebugUiGraph(5, 200f, 220f); _graph.AddSeries(new Color32(255, 64, 64, 255)); AddAuto(_graph); BreakLine(); var frameTimeGauge = new FrameTimeGauge(200f, 30f, _frameTimeWatcher); AddAuto(frameTimeGauge); var slider = new DebugUiSlider("スライダー", -100f, 100f, 400f); slider.onDragEnd = () => { _log.Add("スライダーが" + slider.value + "に変更された"); }; AddAuto(slider); BreakLine(); var table = new DebugUiTable( 16f, new List <float>() { 80f, 80f, 120f }, 3, 20f); table.cells[0, 0] = "列A"; table.cells[0, 1] = "列B"; table.cells[0, 2] = "列C"; table.cells[1, 0] = "データ10"; table.cells[1, 1] = "データ11"; table.cells[1, 2] = "データ12"; table.cells[2, 0] = "データ20"; table.cells[2, 1] = "データ21"; table.cells[2, 2] = "データ23"; AddAuto(table); FitSize(); }