Exemplo n.º 1
0
        /// <summary>
        /// Setups the Avatar Loader instance reference and fills the available files list.
        /// </summary>
        protected void Start()
        {
#if UNITY_EDITOR
            if (!Application.isPlaying)
            {
                if (FreeLookCamPrefab == null || ThirdPersonControllerPrefab == null)
                {
                    if (EditorUtility.DisplayDialog(DialogTitle, "This sample is not configured.\nDo you want to configure it now?", "Yes", "No"))
                    {
                        SetupAvatarLoaderSample();
                    }
                }
            }
#endif
            _avatarLoader = FindObjectOfType <AvatarLoader>();
            if (_avatarLoader == null)
            {
#if TRILIB_OUTPUT_MESSAGES
                Debug.LogError("Could not find any Avatar Loader script instance.");
#endif
                return;
            }
#if UNITY_EDITOR
            var modelsPath = Path.Combine(Path.GetFullPath("./Assets/TriLib/TriLibExtras/Samples"), ModelsDirectory);
#else
            var modelsPath = Path.Combine(Path.GetFullPath("."), ModelsDirectory);
#endif
            var supportedExtensions = AssetLoaderBase.GetSupportedFileExtensions();
            _files      = Directory.GetFiles(modelsPath, "*.*").Where(x => supportedExtensions.Contains(Path.GetExtension(x).ToLower())).ToArray();
            _windowRect = new Rect(20, 20, 240, Screen.height - 40);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Setups the Avatar Loader instance reference and fills the available files list.
        /// </summary>
        protected void Start()
        {
            _avatarLoader = FindObjectOfType <AvatarLoader>();
            if (_avatarLoader == null)
            {
                Debug.LogError("Could not find any Avatar Loader script instance.");
                return;
            }
#if UNITY_EDITOR
            var modelsPath = string.Format("{0}/Samples/{1}", TriLibProjectUtils.FindPathRelativeToProject("TriLibExtras", "t:DefaultAsset TriLibExtras"), ModelsDirectory);
#else
            var modelsPath = Path.Combine(Path.GetFullPath("."), ModelsDirectory);
#endif
            var supportedExtensions = AssetLoaderBase.GetSupportedFileExtensions();
            _files               = Directory.GetFiles(modelsPath, "*.*").Where(x => supportedExtensions.Contains("*" + FileUtils.GetFileExtension(x) + ";")).ToArray();
            _windowRect          = new Rect(20, 20, 240, Screen.height - 40);
            InformationText.text = string.Format(InformationText.text, ModelsDirectory, modelsPath);
        }