当前位置: 首页>>代码示例>>C#>>正文


C# Object.ToString方法代码示例

本文整理汇总了C#中UnityEngine.Object.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Object.ToString方法的具体用法?C# Object.ToString怎么用?C# Object.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnityEngine.Object的用法示例。


在下文中一共展示了Object.ToString方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnGUI


//.........这里部分代码省略.........
                Texture2D preview;
                hotbarPreviewCache.TryGetValue(hotbarObjects[i], out preview);
                if (preview != null)
                    cnt.image = preview;
                else
                    cnt.image = AssetDatabase.GetCachedIcon(AssetDatabase.GetAssetPath(hotbarObjects[i]));

                if(useTooltip)
                    cnt.tooltip = hotbarObjects[i].name;

                Rect r = widgetHost.Widgets[i];
                

                //object selection
                if (e.rawType == EventType.MouseDown)
                {
                    if (r.Contains(e.mousePosition))
                    {
                        //Drag object
                        if (e.button == 0)
                        {
                            if (e.clickCount != 2)
                            {
                                selectedObj = hotbarObjects[i];


                                DragAndDrop.PrepareStartDrag();
                                string path = AssetDatabase.GetAssetPath(selectedObj);
                                if (path != "")
                                    DragAndDrop.paths = new string[] { path };
                                if (selectedObj != null)
                                    DragAndDrop.objectReferences = new Object[] { selectedObj };

                                DragAndDrop.StartDrag(selectedObj.ToString());

                                e.Use();
                            }
                            else if (e.clickCount == 2)
                            {
                                if (hotbarObjects[i].GetType() == EditorPlus.EPlusDefaultType)
                                {
                                    string path = AssetDatabase.GetAssetPath(Selection.activeObject);
                                    if (Directory.Exists(path))
                                    {
                                        string[] subFolders = Directory.GetDirectories(path);
                                        if (subFolders.Length != 0)
                                        {
                                            AssetDatabase.OpenAsset(AssetDatabase.LoadMainAssetAtPath(subFolders[0]));
                                            break;
                                        }

                                        string[] content = Directory.GetFiles(path);
                                        if(content.Length == 0)
                                        {
                                            AssetDatabase.OpenAsset(hotbarObjects[i]);
                                        }
                                        else
                                        {
                                            foreach(string file in content)
                                            {
                                                Object asset = AssetDatabase.LoadMainAssetAtPath(file);
                                                if(asset != null)
                                                {
                                                    EditorGUIUtility.PingObject(asset);
                                                    break;
                                                }
开发者ID:PramgaOnce,项目名称:GlobalGameJam2016,代码行数:67,代码来源:EditorPlusHotbar.cs

示例2: ValidateLevelScene

 private Object ValidateLevelScene(Object levelScene)
 {
     if (levelScene != null) {
         string name = levelScene.ToString ();
         if (name.Contains (" (UnityEngine.SceneAsset)") && name.Contains (LevelsPackage.Suffix)) {
             return levelScene;
         }
     }
     return null;
 }
开发者ID:Randhall,项目名称:RunAndJump,代码行数:10,代码来源:LevelsPackageInspector.cs

示例3: StartLoading

        private void StartLoading()
        {
            Configuration.Instance.Deserilized = false;
            //Configuration.Instance.Initialized = false;

            #if DEBUG
            if (DebugMode)
                Debug.Log("ConfigLoader: loading configuration.");
            #endif
            if (AsyncMode)
            {
               var url = UnityEngine.Application.isEditor ? EditorConfigUrl : ConfigUrl;

            #if DEBUG
               if (DebugMode)
                    Debug.Log(string.Format("ConfigLoader: loading in Async mode [{0}]", url));
            #endif
                _connector = new HttpConnector
                                 {
                                     Url = url,
                                     CacheBuster = CacheBuster,
                                     FaultHandler = OnAsyncFault,
                                     ResponseMode = ResponseMode.WWW,
                                     Timeout = 30,
                                     //LogCalls = true
                                 };
                _connector.Send(new Responder(OnAsyncResult));
            }
            else
            {
            #if DEBUG
                if (DebugMode)
                    Debug.Log(string.Format("ConfigLoader: loading from Resources [{0}]", ConfigPath));
            #endif

                _config = Resources.Load(ConfigPath);

                if (null == _config)
                {
                    string msg = string.Format(ConfigurationException.LoadingError);
            #if DEBUG
                    if (DebugMode)
                        Debug.Log(msg);
            #endif
                    //Alert.Show(msg, "Configuration error");
                    if (null != ResultHandler)
                        ResultHandler(msg);
                }
                else
                {
                    Configuration.Instance.ProcessConfig(_config.ToString());
                    if (null != ResultHandler)
                        ResultHandler(Configuration.Instance.Application);
                }
            }
        }
开发者ID:bwheatley,项目名称:edriven,代码行数:56,代码来源:ConfigLoader.cs

示例4: GetObjectType

        private static ObjectType GetObjectType(Object activeObject)
        {
            if (activeObject == null) return ObjectType.None;

            if (activeObject is GameObject)
            {
				if (Instance._breadcrumbs != null)
					if (activeObject == Instance._breadcrumbs.gameObject) return ObjectType.InspectorBreadcrumbs;

                PrefabType pt = PrefabUtility.GetPrefabType((GameObject)activeObject);
                if (pt == PrefabType.None || pt == PrefabType.DisconnectedModelPrefabInstance || pt == PrefabType.DisconnectedPrefabInstance ||
                    pt == PrefabType.MissingPrefabInstance || pt == PrefabType.ModelPrefabInstance || pt == PrefabType.PrefabInstance) 
                    return ObjectType.Instance;
            }

            if (activeObject as UnityEngine.TextAsset != null)
                return ObjectType.TextAssets;
            
            if (activeObject.ToString().Contains("UnityEngine.SceneAsset"))
                return ObjectType.Scene;

            var asset_path = AssetDatabase.GetAssetPath(activeObject);
            if (string.IsNullOrEmpty(asset_path))
            {
                if (activeObject.GetType().ToString().Contains("AssetStoreAssetInspector"))
                    return ObjectType.AssetStoreAssetInspector;
                else
                    return ObjectType.Asset;
            }
            if (asset_path.StartsWith("ProjectSettings/")) return ObjectType.ProjectSettings;
                
            try
            {
                System.IO.FileAttributes file_attr = System.IO.File.GetAttributes(Application.dataPath + "/" + asset_path.Replace("Assets/", ""));
                if ((file_attr & System.IO.FileAttributes.Directory) == System.IO.FileAttributes.Directory)
                    return ObjectType.Folder;
            }
            catch { }

            return ObjectType.Asset;
        }
开发者ID:howkj1,项目名称:fleecenavidad,代码行数:41,代码来源:InspectorNavigator.cs

示例5: OpenMonoScript

        private void OpenMonoScript()
        {
            string path = EditorUtility.OpenFilePanel( "Open A Template", XEditorSetting.ProjectPath, "" );
            if( path == "" )
                return;

            path = FileUtil.GetProjectRelativePath( path );

            ScriptFile = AssetDatabase.LoadAssetAtPath<MonoScript>( path );

            XLogger.Log( "script is : " + ScriptFile.ToString() );
        }
开发者ID:wuxingogo,项目名称:WuxingogoExtension,代码行数:12,代码来源:CodeReviewEditor.cs

示例6: OnGUI


//.........这里部分代码省略.........
            if (GUI.Button(new Rect(r.x + r.width / 2, r.y, r.width / 2, r.height), new GUIContent("Next", Next)))
            {
                EditorPlusHistoryInternal.HistoryNavigationForward();
            }


            //-----------------------------------------------
            //draw favorites
            for (int i = 0; i < EditorPlusHistoryInternal.favorites.Count; ++i)
            {
                if (GUI.skin != IconsSkinFav)
                    GUI.skin = IconsSkinFav;

                
                r = widgetHostFavs.Widgets[i + 1];

                if (e.rawType == EventType.MouseDown)
                {
                    if (r.Contains(e.mousePosition))
                    {
                        //Drag object
                        if (e.button == 0)
                        {
                            highlightInFavs = true;
                            if (e.clickCount != 2)
                            {
                                selectedObj = EditorPlusHistoryInternal.favorites[i];

                                DragAndDrop.PrepareStartDrag();
                                if (selectedObj.GetType() != typeof(UnityEngine.GameObject))
                                    DragAndDrop.paths = new string[] { AssetDatabase.GetAssetPath(selectedObj) };
                                DragAndDrop.objectReferences = new Object[] { selectedObj };

                                DragAndDrop.StartDrag(selectedObj.ToString());
                            }
                            else if (e.clickCount == 2)
                            {
                                Selection.activeObject = EditorPlusHistoryInternal.favorites[i];

                                if (Selection.activeObject.GetType() != typeof(UnityEngine.GameObject))
                                {
                                    if (Selection.activeObject.GetType() == EditorPlus.EPlusDefaultType)
                                    {
                                        string path = AssetDatabase.GetAssetPath(Selection.activeObject);
                                        if (Directory.Exists(path))
                                        {
                                            string[] subFolders = Directory.GetDirectories(path);
                                            if (subFolders.Length != 0)
                                            {
                                                AssetDatabase.OpenAsset(AssetDatabase.LoadMainAssetAtPath(subFolders[0]));
                                                break;
                                            }

                                            string[] content = Directory.GetFiles(path);
                                            if (content.Length == 0)
                                            {
                                                EditorGUIUtility.PingObject(Selection.activeObject);
                                            }
                                            else
                                            {
                                                foreach (string file in content)
                                                {
                                                    Object asset = AssetDatabase.LoadMainAssetAtPath(file);
                                                    if (asset != null)
                                                    {
                                                        EditorGUIUtility.PingObject(asset);
开发者ID:PramgaOnce,项目名称:GlobalGameJam2016,代码行数:67,代码来源:EditorPlusHistory.cs

示例7: OnUpdateGUI

		protected override void OnUpdateGUI()
		{
			value = GetValue<UnityEngine.Object>();
			dropbox.text = (value == null ? "null" : value.ToString());
		}
开发者ID:procore3d,项目名称:giles,代码行数:5,代码来源:pb_UnityObjectInspector.cs

示例8: OnGUI

    void OnGUI()
    {
        GUILayout.BeginHorizontal();
        bool retVal = GUILayout.Button("Add To", GUILayout.Width(76f));
        GUI.color = Color.white;
        GUILayout.Label("Select the parent in the Hierarchy View", GUILayout.MinWidth(10000f));
        GUILayout.EndHorizontal();
        GUILayout.BeginHorizontal();
        GUILayout.Label("Select TexturePacker metafile");
        m_TexturePackerMetafile = EditorGUILayout.ObjectField(m_TexturePackerMetafile, typeof(TextAsset), false);
        GUILayout.EndHorizontal();

        if (retVal)
        {
            if(m_TexturePackerMetafile != null)
            {
                Dictionary<string, UITextureInfo> test = loadTexturesFromTexturePackerJSON(m_TexturePackerMetafile.ToString());
                foreach(KeyValuePair<string, UITextureInfo> u in test)
                {
                    Debug.Log(u.Key);
                    Debug.Log(u.Value);
                }
            }
            Debug.Log("yay!");
            //CreateMeshes();
        }
    }
开发者ID:fistbump,项目名称:framework,代码行数:27,代码来源:TexturePacker.cs


注:本文中的UnityEngine.Object.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。