用 Sublime 已经有很长一段时间,很舒适,很贴心,根本停不下来。之前因为是开发页游,所以是用 AS3 开发,近段时间,新开了个手游项目,引擎方面选定了 Unity3D,老实说,之前没有太多的 3D 的概念,只是自己偶尔会下个 AS3 写的 3D 引擎玩一下,折腾折腾,并没有实际的工作中用到过相关的东西,如今项目需要用 Unity3D,有些兴奋,这可不是自己折腾的小打小闹了。

Unity 支持的脚本有3种:C#, JS, Boo,我们这边是打算使用 C#,在使用语言的问题上并没有做太多的讨论,一个是效率上,另一个是别的团队的成功经验,所以一开始就选定了 C#。Unity 自带了一个 IDE 叫 MonoDevelop,整个非常小清新的感觉,但遗憾的是,我用了一小段时间,发现非常难以适应,快捷键、效率、主题,以及编辑器的各种特性都让我用得很不舒服,换一套已经熟悉的操作习惯成本太高,无奈之下,只好 Sublime 上场了。

Google 了之后,发现使用 Sublime 来开发 Unity 的还是大有人大,经过一翻折腾,装上各种插件,写好各种配置后,大功告成。在写代码方面完全可以抛弃 MonoDevelop 了,当然断点调试还是需要它的,所以现在的工作台上这3个程序都得开着,Unity 负责场景编辑,Sublime 负责脚本编写,MonoDevelop 负责断点调试。

另外提一下, Sublime 中修改插件非常方便,你打开相应插件的目录,然后打开里面的 py 文件,你改,你保存,你看效果。

以下,就介绍一下我下载的各种插件以及配置。

Sublime 中 C# 注释快捷键

Sublime 注释的快捷键是 ctrl+/,对于不同的语言根据文件的扩展名会有不同的注释类型,不知道为什么这个快捷键在 C# 中似乎是失效了,也找到了解决方法,因为 C# 的注释和 JS 是一样的,所以把 JS 中关于注释那一块的 source 类型加上 cs 就好。具体的操作步骤如下:

1、打开 Sublime 的包目录,Preference -> Browse Packages ...
2、打开 JavaScript,找到 Comments.tmPreferences 并编辑
3、找到并编辑 <string>source.js, source.json, source.cs</string>

C# 语法分析

这个插件是重中之重,它会从 dll 文件中分析相关的类信息以及其他的元信息,然后你在编辑 cs 文件的时候,会在输入 . 的时候触发补全功能,根据不同的上下文,不同的变量,不同的类文件,会显示出相应的变量和方法提示列表,好用到暴!拉下来我们安装:

1、安装插件:CompleteSharp
2、编辑工程文件,工程文件是指扩展名为 *.sublime-project 的文件
3、在工程文件中加入如下相关的 dll 信息

{
"folders":
[
{
"path": "/D/Documents/Unity"
}
],
"settings":
{
"completesharp_assemblies": [
"D:/Program Files (x86)/Unity/Editor/Data/Managed/UnityEngine.dll",
"D:/Program Files (x86)/Unity/Editor/Data/Managed/UnityEditor.dll",
"D:/Program Files (x86)/Unity/Editor/Data/Managed/nunit.framework.dll",
"D:/Program Files (x86)/Unity/Editor/Data/Mono/lib/mono/unity/UnityScript.dll",
"D:/Program Files (x86)/Unity/Editor/Data/Mono/lib/mono/unity/System.Core.dll",
"D:/Program Files (x86)/Unity/Editor/Data/Mono/lib/mono/unity/System.dll",
"D:/Documents/Unity/*/*/*/*/*.dll",
"D:/Documents/Unity/*/*/*/*.dll"
]
}
}

unity.sublime-project

配置文件图如下:

增强版的 All AutoComplete

基本上 All AutoComplete 可以算是必装的几个 Sublime 插件之一,不过我一直觉得 All AutoComplete 还是有点缺陷。按照插件的描述,All AutoComplete 会查询当前所有的标签页,并将分析其中的单词,然后在编辑的时候将合适的单词加入提示列表中。我说的缺陷在于,有一些单词对于我来说,是有必要每次都加入提示列表的,比如我自己有一个自己的代码库,里面就有很多自己写的类,类的例句也是我的风格,但如果要补全的话就需要打开相关的类文件,这是相当蛋疼的,所以一直有想改一下,改成 All AutoComplete 除了它自己分析的单词外,另外再加入我自定义的单词。

其实,这也算不上它的缺陷,只是我个人的的需求,我这个需求还有另外一个方法解决,就是建立相应的代码片断,有多少自定义的单词,就需要建立多少代码片断的文件,太麻烦了。

我试着改了一下 All AutoComplete,编辑 all_views_completions.py 文件,在其中 AllAutocomplete 中加入了一个 __init__ 方法,该方法会在插件初始化的时候去读取一个指定目录下的文件,指定目录下会有若干个文件,文件为一个以 '|' 为分隔符的单词的字符串,比如:Abs|AccelerationEvent,并将所有读取到的单词加入到 self.customs 中,然后在触发补全的方法中,将自定义的单词加入进去,大概效果效果如下(unity.txt 这份文件其实是从 Unity3D/UnityC#.tmLanguage 中扒过来的):

def __init__(self):
words = []
for root, dirs, files in os.walk("D:/Program Files/Sublime Text 2/Conf/Packages/All Autocomplete/custom"):
for name in files:
with open(os.path.join(root, name), "r") as file:
words += file.read().split('|') words = filter_words2(words)
self.customs = without_duplicates(words)

__init__

2015/10/14 修改:因为有一段时间没有高强度的用 Sublime 了,之前的版本也有点不太记得了,刚刚试了下,拿最新版本的 All Autocomplete 修改了一下,亲测可用,不过单词的读取就没有读文件了,有需要的同学自己修改一下吧:

 # Extends Sublime Text autocompletion to find matches in all open
# files. By default, Sublime only considers words from the current file. import sublime_plugin
import sublime
import re
import time
from os.path import basename # limits to prevent bogging down the system
MIN_WORD_SIZE = 3
MAX_WORD_SIZE = 50 MAX_VIEWS = 20
MAX_WORDS_PER_VIEW = 100
MAX_FIX_TIME_SECS_PER_VIEW = 0.01 # custom words
CUSTOM = ["ADBannerView","ADInterstitialAd","Abs","AcceptDrag","Acos","ActivateCurrentOffMeshLink","Add","AddBinaryData","AddClip","AddColor","AddComponent","AddComponentMenu","AddControl","AddCursorRect","AddDefaultControl","AddDisabledItem","AddEvent","AddExplosionForce","AddField","AddFloat","AddForce","AddForceAtPosition","AddFramesFromFile","AddIsValid","AddItem","AddKey","AddMatrix","AddMixingTransform","AddObjectToAsset","AddRange","AddRelativeForce","AddRelativeTorque","AddSeparator","AddTexture","AddTorque","AddTreeInstance","AddVector","AllocObject","AllocateViewID","AndroidJavaClass","AndroidJavaObject","AndroidJavaProxy","Angle","AngleAxis","AnimationClip","AnimationCurve","AnimationEvent","Apply","ApplyMaterialPropertyDrawers","ApplyModifiedProperties","ApplyTextureType","Approximately","AreStaticEditorFlagsSet","ArrayEquals","ArrowCap","Asin","AssetPathToGUID","Atan","Atan2","AttachCurrentThread","AttachToCollider","Authenticate","Authorize","Awake","Bake","BakeAsync","BakeLightProbesOnly","BakeLightProbesOnlyAsync","BakeMesh","BakeSelected","BakeSelectedAsync","Beep","Begin","BeginArea","BeginChangeCheck","BeginDisabledGroup","BeginGUI","BeginGroup","BeginHorizontal","BeginProperty","BeginSample","BeginScrollView","BeginToggleGroup","BeginVertical","BeginWindows","Blend","Blit","BlitMultiTap","BoneFromMuscle","Bounds","BoundsField","Box","Break","BringWindowToBack","BringWindowToFront","BroadcastMessage","BrowseURL","BuildAssetBundle","BuildAssetBundleExplicitAssetNames","BuildGenericAvatar","BuildHumanAvatar","BuildNavMesh","BuildNavMeshAsync","BuildPlayer","BuildStreamedSceneAssetBundle","Button","CacheProceduralProperty","CalcHeight","CalcLineTranslation","CalcMinMaxWidth","CalcScreenSize","CalcSize","CalculateFrustumPlanes","CalculateLODGroupBoundingBox","CalculatePath","CalculateTransformPath","CalculateTriangulation","Call","CallBooleanMethod","CallByteMethod","CallCharMethod","CallDoubleMethod","CallFloatMethod","CallIntMethod","CallLongMethod","CallObjectMethod","CallShortMethod","CallStatic","CallStaticBooleanMethod","CallStaticByteMethod","CallStaticCharMethod","CallStaticDoubleMethod","CallStaticFloatMethod","CallStaticIntMethod","CallStaticLongMethod","CallStaticObjectMethod","CallStaticShortMethod","CallStaticStringMethod","CallStaticVoidMethod","CallStringMethod","CallVoidMethod","CanStreamedLevelBeLoaded","Cancel","CancelAllLocalNotifications","CancelInvoke","CancelLocalNotification","CancelQuit","CapsuleCast","CapsuleCastAll","CaptureScreenshot","Ceil","CeilToInt","ChangeSetDescription","ChangeSetMove","ChangeSetStatus","ChangeSets","CheckCapsule","CheckSphere","Checkout","CheckoutIsValid","CircleCap","Clamp","Clamp01","ClampMagnitude","CleanCache","Clear","ClearAllNavMeshes","ClearArray","ClearCache","ClearCamera","ClearCorners","ClearCurves","ClearDeveloperConsole","ClearHostList","ClearLabels","ClearLocalNotifications","ClearParticles","ClearPlatformTextureSettings","ClearProgressBar","ClearRandomWriteTargets","ClearRemoteNotifications","ClearUndo","ClearWithSkybox","CloneMaterial","Close","CloseConnection","ClosestPointOnBounds","ClosestPointToArc","ClosestPointToDisc","ClosestPointToPolyLine","ClosestPowerOfTwo","CollapseUndoOperations","CollectDeepHierarchy","CollectDependencies","Color","Color32","ColorField","ColorProperty","Combine","CombineMeshes","CommandEvent","CompareTag","CompleteOffMeshLink","Compress","CompressTexture","Compute","ComputeBuffer","ComputeMD5Hash","ComputeSHA1Hash","ConeCap","Connect","Contains","ContextMenu","ConvertFromJNIArray","ConvertToJNIArray","Copy","CopyAsset","CopyCount","CopyFileOrDirectory","CopyFileOrDirectoryFollowSymlinks","CopyFrom","CopyFromSerializedProperty","CopyPropertiesFromMaterial","CopySerialized","CopyTo","Cos","CountInProperty","CountRemaining","Create","CreateAchievement","CreateAsset","CreateDirectory","CreateEditor","CreateEmptyPrefab","CreateExternalTexture","CreateFolder","CreateFromFile","CreateFromMemory","CreateGameObjectWithHideFlags","CreateInstance","CreateJNIArgArray","CreateJavaProxy","CreateJavaRunnable","CreateLeaderboard","CreateOrUpdateSecondary","CreatePrefab","CreatePrimitive","CreateTerrainGameObject","Cross","CrossFade","CrossFadeQueued","CubeCap","Cubemap","CurveField","CustomEditor","CustomPropertyDrawer","CylinderCap","DecreaseLevel","DefaultShaderProperty","Delete","DeleteAll","DeleteArrayElementAtIndex","DeleteAsset","DeleteChangeSets","DeleteChangeSetsIsValid","DeleteCommand","DeleteFileOrDirectory","DeleteGlobalRef","DeleteJNIArgArray","DeleteKey","DeleteLocalRef","DeleteSecondary","DeltaAngle","Destroy","DestroyImmediate","DestroyMaterial","DestroyObjectImmediate","DestroyPlayerObjects","DetachChildren","DetachCurrentThread","DetachFromCollider","DiffHead","DiffIsValid","DisableKeyword","Disc","DiscardContents","Disconnect","DisconnectPrefabInstance","Dispatch","DisplayCancelableProgressBar","DisplayDialog","DisplayDialogComplex","DisplayPopupMenu","DisplayProgressBar","DisplayWizard","Dispose","Distance","DistancePointBezier","DistancePointLine","DistancePointToLine","DistancePointToLineSegment","DistanceToArc","DistanceToCircle","DistanceToDisc","DistanceToLine","DistanceToPolyLine","DistanceToRectangle","DoesSourceTextureHaveAlpha","DoesSourceTextureHaveColor","DontDestroyOnLoad","Dot","DotCap","DragWindow","Draw","DrawAAPolyLine","DrawBezier","DrawCamera","DrawColorSwatch","DrawCube","DrawCursor","DrawCurveSwatch","DrawDefaultInspector","DrawFrustum","DrawGUITexture","DrawGizmo","DrawHeader","DrawIcon","DrawLine","DrawMesh","DrawMeshNow","DrawPolyLine","DrawPreviewTexture","DrawProcedural","DrawProceduralIndirect","DrawRay","DrawRegionSwatch","DrawSolidArc","DrawSolidDisc","DrawSolidRectangleWithOutline","DrawSphere","DrawTexture","DrawTextureAlpha","DrawTextureWithTexCoords","DrawWireArc","DrawWireCube","DrawWireDisc","DrawWireSphere","DrawWithTextSelection","DropDown","DropShadowLabel","DuplicateCommand","EaseInOut","Edit","Emit","EnableKeyword","Encapsulate","EncodeToPNG","End","EndArea","EndChangeCheck","EndDisabledGroup","EndGUI","EndGroup","EndHorizontal","EndProperty","EndSample","EndScrollView","EndToggleGroup","EndVertical","EndWindows","EnsureLocalCapacity","EnumMaskField","EnumPopup","Equal","EqualContents","EscapeURL","Euler","Evaluate","ExceptionClear","ExceptionDescribe","ExceptionOccurred","ExecuteMenuItem","Exists","Exit","Exp","Expand","ExpandHeight","ExpandWidth","ExportPackage","Expression","ExternalCall","ExternalEval","ExtractOggFile","FatalError","Filter","FilterChildren","FilterCount","Find","FindClass","FindClosestEdge","FindGameObjectsWithTag","FindIndex","FindKernel","FindObjectOfType","FindObjectsOfType","FindObjectsOfTypeAll","FindPrefabRoot","FindProperty","FindPropertyRelative","FindRootGameObjectWithSameParentPref","abFindStyle","FindTexture","FindValidUploadPrefabInstanceRoot","FindWithTag","FixedUpdate","FlexibleSpace","FloatField","FloatProperty","Floor","FloorToInt","Flush","Focus","FocusControl","FocusProjectWindow","FocusTextInControl","FocusWindow","FocusWindowIfItsOpen","Foldout","Font","ForceLOD","FormatBytes","FreeMoveHandle","FreeRotateHandle","FromBooleanArray","FromByteArray","FromCharArray","FromDoubleArray","FromFloatArray","FromIntArray","FromLongArray","FromMonoBehaviour","FromObjectArray","FromReflectedField","FromReflectedMethod","FromScriptableObject","FromShortArray","FromToRotation","GUIContent","GUIDToAssetPath","GUIPointToWorldRay","GUIStyle","GUIToScreenPoint","GameObject","GammaToLinearSpace","GenerateEditableFont","GenerateInBackground","GeneratePerTriangleUV","GenerateSecondaryUVSet","GenerateUniqueAssetPath","Get","GetAccelerationEvent","GetActiveConfigFields","GetActivePlugin","GetActivityIndicatorStyle","GetAllCurves","GetAlphamaps","GetAnimationClips","GetAnimationEvents","GetAnimationUpdateRate","GetAnimatorTransitionInfo","GetArrayElementAtIndex","GetArrayLength","GetAspectRect","GetAssetByGUID","GetAssetByPath","GetAssetListFromSelection","GetAssetOrScenePath","GetAssetPath","GetAtPath","GetAudioClip","GetAveragePing","GetAxis","GetAxisRaw","GetBlendShapeName","GetBlendShapeWeight","GetBoneTransform","GetBool","GetBooleanArrayElement","GetBooleanField","GetBuiltinSkin","GetButton","GetButtonDown","GetButtonUp","GetByteArrayElement","GetByteField","GetCachedIcon","GetCharArrayElement","GetCharField","GetCharacterInfo","GetChild","GetClass","GetClassName","GetClipCount","GetCollisionEvents","GetColor","GetColumn","GetComponent","GetComponentInChildren","GetComponents","GetComponentsInChildren","GetConstructorID","GetControlID","GetControlRect","GetCurrentAnimationClipState","GetCurrentAnimatorStateInfo","GetCurrentGroup","GetCursorPixelPosition","GetCursorStringIndex","GetDSPBufferSize","GetData","GetDefaultPropertyHeight","GetDependencies","GetDetailLayer","GetDeviceCaps","GetDistanceToPoint","GetDoubleArrayElement","GetDoubleField","GetDragAndDropTitle","GetEditorCurve","GetEndProperty","GetEnumerator","GetFieldID","GetFiltered","GetFloat","GetFloatArrayElement","GetFloatField","GetFloatValue","GetGPUProjectionMatrix","GetGenerateAllOutputs","GetGeneratedTexture","GetGeneratedTextures","GetGenericData","GetGroundHit","GetHandleSize","GetHeight","GetHeights","GetIKPosition","GetIKPositionWeight","GetIKRotation","GetIKRotationWeight","GetIconSize","GetIconSizesForTargetGroup","GetIconsForTargetGroup","GetIgnoreLayerCollision","GetIndices","GetInfoString","GetInspectorTitle","GetInstanceID","GetInt","GetIntArrayElement","GetIntField","GetInteger","GetInterpolatedHeight","GetInterpolatedLightProbe","GetInterpolatedNormal","GetItemCount","GetIterator","GetJoystickNames","GetKey","GetKeyDown","GetKeyUp","GetLabels","GetLastPing","GetLastRect","GetLatest","GetLatestIsValid","GetLayerCost","GetLayerName","GetLayerWeight","GetLocalNotification","GetLongArrayElement","GetLongField","GetMaterialCount","GetMaterialOffset","GetMaterialProperties","GetMaterialProperty","GetMaterialScale","GetMaterials","GetMatrix","GetMethodID","GetMonoHeapSize","GetMonoUsedSize","GetMouseButton","GetMouseButtonDown","GetMouseButtonUp","GetMuscleDefaultMax","GetMuscleDefaultMin","GetNameOfFocusedControl","GetNativeTextureID","GetNativeTexturePtr","GetNavMeshLayer","GetNavMeshLayerFromName","GetNavMeshLayerNames","GetNextAnimationClipState","GetNextAnimatorStateInfo","GetObjectArrayElement","GetObjectClass","GetObjectEnabled","GetObjectField","GetObjectPickerControlID","GetObjectPickerObject","GetOutputData","GetParticles","GetPath","GetPixel","GetPixelBilinear","GetPixels","GetPixels32","GetPlatformTextureSettings","GetPoint","GetPointVelocity","GetPosition","GetPostprocessOrder","GetPrefabObject","GetPrefabParent","GetPrefabType","GetPreviewTitle","GetProceduralBoolean","GetProceduralColor","GetProceduralEnum","GetProceduralFloat","GetProceduralOutputType","GetProceduralPropertyDescriptions","GetProceduralTexture","GetProceduralVector","GetPropertyCount","GetPropertyDescription","GetPropertyHeight","GetPropertyModifications","GetPropertyName","GetPropertyType","GetPrototypeNames","GetQualityLevel","GetRangeLimits","GetRawClass","GetRawObject","GetRayIntersection","GetRayIntersectionAll","GetRayIntersectionNonAlloc","GetRect","GetRelativePointVelocity","GetRemoteNotification","GetRow","GetRuntimeMemorySize","GetScreenRect","GetScriptingDefineSymbolsForGroup","GetSecondaries","GetSecondary","GetSecondaryTouch","GetShortArrayElement","GetShortField","GetSide","GetSignature","GetSpectrumData","GetStateObject","GetStatic","GetStaticBooleanField","GetStaticByteField","GetStaticCharField","GetStaticDoubleField","GetStaticEditorFlags","GetStaticFieldID","GetStaticFloatField","GetStaticIntField","GetStaticLongField","GetStaticMethodID","GetStaticObjectField","GetStaticShortField","GetStaticStringField","GetSteepness","GetStreamProgressForLevel","GetString","GetStringField","GetStringUTFChars","GetStringUTFLength","GetStyle","GetSuperclass","GetSupportedLayers","GetTag","GetTemplate","GetTemporary","GetTexDim","GetTextMetaDataPathFromAssetPath","GetTexture","GetTextureAlphaSource","GetTextureOffset","GetTextureScale","GetTopology","GetTotalPointCount","GetTouch","GetTransforms","GetTriangles","GetTypeForControl","GetUniqueTempPathInProject","GetVector","GetVersion","GetWindow","GetWindowWithRect","Gradient","GradientAlphaKey","GradientColorKey","HSVToRGB","HandlePrefixLabel","HasAspectRatio","HasCameraPermissions","HasCharacter","HasGPSPermissions","HasHelpForObject","HasIdentificationPermissions","HasKey","HasMicrophonePermissions","HasObjectThumbnail","HasPreviewGUI","HasProLicense","HasProceduralProperty","HasProperty","HasSharedPermissions","HasUserAuthorization","HavePublicAddress","Height","HelpBox","Hide","Highlight","HighlightIdentifier","HitTest","HorizontalScrollbar","HorizontalSlider","IgnoreCollision","IgnoreLayerCollision","Import","ImportAsset","ImportPackage","InAnimationMode","Incoming","IncomingChangeSetAssets","IncreaseLevel","IncrementCurrentGroup","IndexOf","InitializeSecurity","InitializeServer","Insert","InsertArrayElementAtIndex","InspectorTitlebar","InstanceIDToObject","Instantiate","InstantiateAttachedAsset","InstantiateMaterial","InstantiatePrefab","IntField","IntPopup","IntSlider","InterruptMatchTarget","IntersectRay","Intersects","InvalidateState","Inverse","InverseLerp","InverseTransformDirection","InverseTransformPoint","Invoke","InvokeOnAppThread","InvokeOnUIThread","InvokeRepeating","IsAlive","IsAssignableFrom","IsAvailable","IsAwake","IsChildOf","IsCreated","IsInTransition","IsInstanceOf","IsInvoking","IsMainAsset","IsName","IsOneOfStates","IsOpenForEdit","IsParameterControlledByCurve","IsPersistent","IsPlaying","IsPowerOfTwo","IsProceduralPropertyCached","IsPropertyAnimated","IsRecording","IsSameObject","IsShaderPropertyHidden","IsSleeping","IsState","IsSubAsset","IsTag","IsUserName","IsVersionCached","IssuePluginEvent","KeyboardEvent","Keyframe","LOD","Label","LabelField","LastIndexOf","LateUpdate","LayerField","LayerMask","LayerToName","Lerp","LerpAngle","Linear","LinearToGammaSpace","Linecast","LinecastAll","LinecastNonAlloc","Load","LoadAchievementDescriptions","LoadAchievements","LoadAll","LoadAllAssetRepresentationsAtPath","LoadAllAssetsAtPath","LoadAssetAtPath","LoadAsync","LoadFriends","LoadFromCacheOrDownload","LoadIdentity","LoadImage","LoadImageIntoTexture","LoadLevel","LoadLevelAdditive","LoadLevelAdditiveAsync","LoadLevelAsync","LoadMainAssetAtPath","LoadOrtho","LoadPixelMatrix","LoadProjectionMatrix","LoadRequired","LoadScores","LoadUnityWeb","LoadUsers","LocalNotification","Lock","LockIsValid","LockReloadAssemblies","Log","Log10","LogError","LogException","LogWarning","LookAt","LookLikeControls","LookRotation","MarkAsUsed","MarkDynamic","MarkNonReadable","MarkRestoreExpected","MaskField","MatchTarget","MatchTargetWeightMask","Material","Max","MaxHeight","MaxWidth","MenuCommand","MenuItem","Merge","MergeAllPrefabInstances","Mesh","Min","MinHeight","MinMaxRect","MinMaxSlider","MinWidth","ModalWindow","Move","MoveArrayElement","MoveAsset","MoveAssetToTrash","MoveFileOrDirectory","MoveKey","MovePosition","MoveRotation","MoveTowards","MoveTowardsAngle","MultMatrix","MultiTexCoord","MultiTexCoord2","MultiTexCoord3","MultiplyPoint","MultiplyPoint3x4","MultiplyVector","MuscleFromBone","NameToLayer","NavMeshPath","NewBooleanArray","NewByteArray","NewCharArray","NewDoubleArray","NewFloatArray","NewGlobalRef","NewIntArray","NewLocalRef","NewLongArray","NewObject","NewObjectArray","NewScene","NewShortArray","NewStringUTF","Next","NextPowerOfTwo","NextVisible","NicifyVariableName","Normalize","ObjectContent","ObjectField","OnAnimatorIK","OnAnimatorMove","OnApplicationFocus","OnApplicationPause","OnApplicationQuit","OnAssignMaterialModel","OnAudioFilterRead","OnBecameInvisible","OnBecameVisible","OnCollisionEnter","OnCollisionEnter2D","OnCollisionExit","OnCollisionExit2D","OnCollisionStay","OnCollisionStay2D","OnConnectedToServer","OnControllerColliderHit","OnDestroy","OnDidOpenScene","OnDisable","OnDisconnectedFromServer","OnDrawGizmos","OnDrawGizmosSelected","OnEnable","OnFailedToConnect","OnFailedToConnectToMasterServer","OnFocus","OnGUI","OnGroupAtlases","OnHierarchyChange","OnInspectorGUI","OnInspectorUpdate","OnInteractivePreviewGUI","OnJointBreak","OnLevelWasLoaded","OnLostFocus","OnMasterServerEvent","OnMouseDown","OnMouseDrag","OnMouseEnter","OnMouseExit","OnMouseOver","OnMouseUp","OnMouseUpAsButton","OnNetworkInstantiate","OnParticleCollision","OnPlayerConnected","OnPlayerDisconnected","OnPostRender","OnPostprocessAllAssets","OnPostprocessAudio","OnPostprocessGameObjectWithUserProperties","OnPostprocessModel","OnPostprocessTexture","OnPreCull","OnPreRender","OnPreprocessAudio","OnPreprocessModel","OnPreprocessTexture","OnPreviewGUI","OnPreviewSettings","OnProjectChange","OnRenderImage","OnRenderObject","OnSceneGUI","OnSelectionChange","OnSerializeNetworkView","OnServerInitialized","OnShaderModified","OnTriggerEnter","OnTriggerEnter2D","OnTriggerExit","OnTriggerExit2D","OnTriggerStay","OnTriggerStay2D","OnValidate","OnWillCreateAsset","OnWillDeleteAsset","OnWillMoveAsset","OnWillRenderObject","OnWillSaveAssets","OnWizardCreate","OnWizardOtherButton","OnWizardUpdate","Open","OpenAsset","OpenFilePanel","OpenFolderPanel","OpenProject","OpenScene","OpenSceneAdditive","OpenURL","Optimize","Ortho","OrthoNormalize","OverlapArea","OverlapAreaAll","OverlapAreaNonAlloc","OverlapCircle","OverlapCircleAll","OverlapCircleNonAlloc","OverlapPoint","OverlapPointAll","OverlapPointNonAlloc","OverlapSphere","PackTextures","PasswordField","Pause","PerformRedo","PerformUndo","PeriodicBadgeUpdate","PeriodicUpdate","PerlinNoise","Perspective","PhysicMaterial","PickGameObject","PickRectObjects","Ping","PingObject","PingPong","Plane","Play","PlayClipAtPoint","PlayDelayed","PlayFullScreenMovie","PlayOneShot","PlayQueued","PlayScheduled","PointOnLineParameter","PollHostList","PopAssetDependencies","PopCamera","PopLocalFrame","PopMatrix","Popup","PositionHandle","Pow","PreferenceItem","PrefetchSocketPolicy","PrefixLabel","PrepareStartDrag","PresentLocalNotificationNow","ProgressBar","Project","ProjectPointLine","PropertiesChanged","PropertiesGUI","PropertyField","PropertyToID","PushAssetDependencies","PushCamera","PushLocalFrame","PushMatrix","Quaternion","QueryStateObject","QueueGameViewInputEvent","Quit","RGBToHSV","RPC","RadiusHandle","Range","RangeProperty","Ray","RaySnap","Raycast","RaycastAll","RaycastNonAlloc","ReadAllBytes","ReadPixels","ReadTextureImportInstructions","ReadTextureSettings","RebuildTextures","RebuildTexturesImmediately","RecalculateBounds","RecalculateNormals","ReconnectToLastPrefab","RecordObject","RecordObjects","RecordPrefabInstancePropertyModifications","Rect","RectField","RectOffset","Reflect","Refresh","RefreshPrototypes","RegisterCreatedObjectUndo","RegisterForRemoteNotificationTypes","RegisterHost","RegisterLogCallback","RegisterLogCallbackThreaded","RegisterPropertyChangeUndo","Release","ReleaseTemporary","ReloadAd","Remove","RemoveAll","RemoveAt","RemoveBadge","RemoveClip","RemoveKey","RemoveMixingTransform","RemoveNotification","RemoveRPCs","RemoveRPCsInGroup","RenameAsset","RenameMaterial","Render","RenderGameViewCameras","RenderStaticPreview","RenderTexture","RenderToCubemap","RenderWithShader","Repaint","RepaintHierarchyWindow","RepaintProjectWindow","Repeat","RepeatButton","ReplaceDirectory","ReplaceFile","ReplacePrefab","ReportProgress","ReportScore","RequestCharactersInTexture","RequestHostList","RequestUserAuthorization","RequireComponent","RequiredBone","Reset","ResetAllAchievements","ResetAspect","ResetInputAxes","ResetMaterial","ResetNoBackupFlag","ResetPath","ResetProjectionMatrix","ResetReplacementShader","ResetToPrefabState","ResetWorldToCameraMatrix","Resize","Resolve","ResolveIsValid","Resume","Revert","RevertAllDownToGroup","RevertAllInCurrentGroup","RevertIsValid","RevertPrefabInstance","Rewind","Rotate","RotateAround","RotateAroundPivot","RotateTowards","RotationHandle","Round","RoundToInt","RunningOnAppThread","RunningOnUIThread","SameSide","Sample","SampleAnimation","SampleAnimationClip","SampleHeight","SamplePathPosition","SamplePosition","Save","SaveAssets","SaveCurrentSceneIfUserWantsTo","SaveFilePanel","SaveFilePanelInProject","SaveFolderPanel","SaveScene","Scale","ScaleAroundPivot","ScaleHandle","ScaleSlider","ScaleValueHandle","ScheduleLocalNotification","ScreenPointToRay","ScreenToGUIPoint","ScreenToViewportPoint","ScreenToWorldPoint","ScrollTo","SecondaryTileData","SelectableLabel","SelectionFrame","SelectionGrid","SendEvent","SendMessage","SendMessageUpwards","Serialize","SerializedObject","Set","Set3Points","SetActive","SetActivityIndicatorStyle","SetAlphamaps","SetAnimationClips","SetAnimationEvents","SetAnimationUpdateRate","SetAspectRatio","SetBlendShapeWeight","SetBool","SetBooleanArrayElement","SetBooleanField","SetBuffer","SetByteArrayElement","SetByteField","SetCamera","SetCameraPermissions","SetCharArrayElement","SetCharField","SetColor","SetColors","SetColumn","SetCompletionAction","SetCursor","SetCurve","SetDSPBufferSize","SetData","SetDefaults","SetDensity","SetDestination","SetDetailLayer","SetDetailResolution","SetDirty","SetDoubleArrayElement","SetDoubleField","SetEditorCurve","SetEnabledFading","SetFloat","SetFloatArrayElement","SetFloatField","SetFloats","SetFromToRotation","SetGPSPermissions","SetGenerateAllOutputs","SetGenericData","SetGlobalAnisotropicFilteringLimits","SetGlobalColor","SetGlobalFloat","SetGlobalMatrix","SetGlobalShaderProperty","SetGlobalTexture","SetGlobalVector","SetHeights","SetIKPosition","SetIKPositionWeight","SetIKRotation","SetIKRotationWeight","SetIconSize","SetIconsForTargetGroup","SetIdentificationPermissions","SetIndices","SetInt","SetIntArrayElement","SetIntField","SetInteger","SetInts","SetIsDifferentCacheDirty","SetKeys","SetLODS","SetLabels","SetLayerCost","SetLayerWeight","SetLevelPrefix","SetLongArrayElement","SetLongField","SetLookAtPosition","SetLookAtWeight","SetLookRotation","SetMaterialOffset","SetMaterialScale","SetMatrix","SetMicrophonePermissions","SetMinMax","SetNameSmart","SetNavMeshLayer","SetNeighbors","SetNextControlName","SetNoBackupFlag","SetNormalAndPosition","SetObjectArrayElement","SetObjectEnabled","SetObjectField","SetParticles","SetPass","SetPath","SetPerTriangleUV2","SetPixel","SetPixels","SetPixels32","SetPlatformTextureSettings","SetPosition","SetProceduralBoolean","SetProceduralColor","SetProceduralEnum","SetProceduralFloat","SetProceduralTexture","SetProceduralVector","SetPropertyBlock","SetPropertyModifications","SetQualityLevel","SetRandomWriteTarget","SetReceivingEnabled","SetRenderTarget","SetRenderingResolution","SetReplacementShader","SetResolution","SetRevertBackfacing","SetRow","SetScheduledEndTime","SetScheduledStartTime","SetScope","SetScriptingDefineSymbolsForGroup","SetSelectedWireframeHidden","SetSendingEnabled","SetShader","SetSharedPermissions","SetShortArrayElement","SetShortField","SetStatic","SetStaticBooleanField","SetStaticByteField","SetStaticCharField","SetStaticDoubleField","SetStaticEditorFlags","SetStaticFloatField","SetStaticIntField","SetStaticLongField","SetStaticObjectField","SetStaticShortField","SetStaticStringField","SetString","SetStringField","SetTRS","SetTarget","SetTargetBuffers","SetTexture","SetTextureAlphaSource","SetTextureOffset","SetTextureScale","SetTextureSettings","SetTransformParent","SetTriangles","SetTrigger","SetUserFilter","SetVector","SetVertexCount","SetWidth","ShaderProperty","Show","ShowAchievementsUI","ShowAsContext","ShowAsDropDown","ShowAuxWindow","ShowDefaultAchievementCompletionBanner","ShowHelpForObject","ShowHelpPage","ShowLeaderboardUI","ShowNotification","ShowObjectPicker","ShowPopup","ShowUtility","Sign","SimpleMove","Simulate","Sin","Sleep","Slerp","Slider","Slider2D","SmoothDamp","SmoothDampAngle","SmoothEdges","SmoothStep","SmoothTangents","SnapValue","Space","SphereCap","SphereCast","SphereCastAll","SqrDistance","Sqrt","Start","StartActivityIndicator","StartAnimationMode","StartAssetEditing","StartCoroutine","StartDrag","StartPlayback","StartRecording","Statement","Status","Step","Stop","StopActivityIndicator","StopAllCoroutines","StopAnimationMode","StopAssetEditing","StopCoroutine","StopPeriodicBadgeUpdate","StopPeriodicUpdate","StopPlayback","StopRebuilds","StopRecording","StringToHash","Submit","SubmitIsValid","SupportsRenderTextureFormat","SupportsStencil","SweepTest","SweepTestAll","TRS","TagField","Tan","TestConnection","TestConnectionNAT","TestPlanesAABB","Tetrahedralize","TexCoord","TexCoord2","TexCoord3","TextArea","TextField","Texture2D","Texture3D","TextureProperty","Throw","ThrowNew","ToAngleAxis","ToBooleanArray","ToByteArray","ToCharArray","ToDoubleArray","ToFloatArray","ToIntArray","ToLongArray","ToObjectArray","ToReflectedField","ToReflectedMethod","ToShortArray","ToString","Toggle","ToggleLeft","Toolbar","TransformDirection","TransformPoint","Translate","UnEscapeURL","UnfocusWindow","Unload","UnloadAsset","UnloadUnusedAssets","UnloadUnusedAssetsIgnoreManagedReferences","UnlockIsValid","UnlockReloadAssemblies","UnregisterForRemoteNotifications","UnregisterHost","Update","UpdateBadgeImage","UpdateBadgeNumber","UpdateExternalTexture","UpdateIfDirtyOrScript","UpdatePositions","UpdateSettings","Use","UseDefaultMargins","ValidateMoveAsset","Vector2Field","Vector3FieldVector4Field","VectorProperty","Vertex","Vertex3","VerticalScrollbar","VerticalSlider","Vibrate","Viewport","ViewportPointToRay","ViewportToScreenPoint","ViewportToWorldPoint","WWW","WWWForm","Wait","WaitForSeconds","WakeUp","WarmupAllShaders","Warp","WebCamTexture","Width","Window","WorldPointToSizedRect","WorldToGUIPoint","WorldToScreenPoint","WorldToViewportPoint","WriteAllBytes","WriteImportSettingsIfDirty","bool","print"] class AllAutocomplete(sublime_plugin.EventListener): def on_query_completions(self, view, prefix, locations):
words = []
# Limit number of views but always include the active view. This
# view goes first to prioritize matches close to cursor position.
other_views = [v for v in sublime.active_window().views() if v.id != view.id]
views = [view] + other_views
views = views[0:MAX_VIEWS] for v in views:
if len(locations) > 0 and v.id == view.id:
view_words = v.extract_completions(prefix, locations[0])
else:
view_words = v.extract_completions(prefix)
view_words = filter_words(view_words)
view_words = fix_truncation(v, view_words)
words += [(w, v) for w in view_words] # add custom words
words += [(w, view) for w in CUSTOM if is_completion(prefix, w)] words = without_duplicates(words)
matches = []
for w, v in words:
trigger = w
contents = w.replace('$', '\\$')
if v.id != view.id and v.file_name():
trigger += '\t(%s)' % basename(v.file_name())
matches.append((trigger, contents)) return matches def filter_words(words):
words = words[0:MAX_WORDS_PER_VIEW]
return [w for w in words if MIN_WORD_SIZE <= len(w) <= MAX_WORD_SIZE] # keeps first instance of every word and retains the original order
# (n^2 but should not be a problem as len(words) <= MAX_VIEWS*MAX_WORDS_PER_VIEW)
def without_duplicates(words):
result = []
used_words = []
for w, v in words:
if w not in used_words:
used_words.append(w)
result.append((w, v))
return result # Ugly workaround for truncation bug in Sublime when using view.extract_completions()
# in some types of files.
def fix_truncation(view, words):
fixed_words = []
start_time = time.time() for i, w in enumerate(words):
#The word is truncated if and only if it cannot be found with a word boundary before and after # this fails to match strings with trailing non-alpha chars, like
# 'foo?' or 'bar!', which are common for instance in Ruby.
match = view.find(r'\b' + re.escape(w) + r'\b', 0)
truncated = is_empty_match(match)
if truncated:
#Truncation is always by a single character, so we extend the word by one word character before a word boundary
extended_words = []
view.find_all(r'\b' + re.escape(w) + r'\w\b', 0, "$0", extended_words)
if len(extended_words) > 0:
fixed_words += extended_words
else:
# to compensate for the missing match problem mentioned above, just
# use the old word if we didn't find any extended matches
fixed_words.append(w)
else:
#Pass through non-truncated words
fixed_words.append(w) # if too much time is spent in here, bail out,
# and don't bother fixing the remaining words
if time.time() - start_time > MAX_FIX_TIME_SECS_PER_VIEW:
return fixed_words + words[i+1:] return fixed_words def is_completion(trigger, content):
trigger = trigger.lower()
content = content.lower()
ci = 0
cl = len(content)
ti = 0
tl = len(trigger)
while True:
if content[ci] == trigger[ti]:
ti = ti + 1
ci = ci + 1
if ti == tl:
return True
if ci == cl:
return False if sublime.version() >= '':
def is_empty_match(match):
return match.empty()
else:
def is_empty_match(match):
return match is None

All Autocomplete

Unity3D 脚本参考

写代码的过程中,经常会需要查 API 文档,所以方便的查 API 文档是一个重要的功能。Sublime 本身并不提供类似的功能,但这难不倒各位程序员童鞋,我在网上找到一个插件:Unity3D Script Reference Search,这个插件的作用就是搜索 API,可以搜索当前光标上的单词,也可以输入指定的内容。这个插件干的事情非常简单,其实就是在插件中调用 webbrowser.open_new_tab(url) ,其中 url 就是拼成的一个查询链接。不过这个插件访问的 url 却是官网的在线 API,而实际上在本地是也有一份 API 文档的,通过 Unity 菜单 Help -> Scripting Reference 可以访问。

我试着改了一下插件,修改 Unity3DScriptReference.py 文件,将其中的 url 链接改成指向本地的文件,似乎并不生效,web 这一块我不熟悉,所以我干脆简单点,用 Python 开一个简单的 http 服务,我在 使用Python创建简单的HTTP和FTP服务 中有介绍,直接在 Unity 目录下面开一个 http 服务,最终的效果图如下:

2014/5/23 修改:因为有先入为主的想法,以为只能用 webbrowser 来访问网页,实际上是不需要的,http 服务也是没必要开的,上面的代码只要改一下就可以,将 webbrowser.open_new_tab 改成 subprocess.call 就可以了,如下:

browser = "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe "

def SearchUnityScriptReferenceFor(text):
# url = 'http://unity3d.com/support/documentation/ScriptReference/30_search.html?q=' + text.replace(' ','%20')
url = 'file:///D:/Program%20Files%20(x86)/Unity/Editor/Data/Documentation/Documentation/ScriptReference/30_search.html?q=' + text.replace(' ','%20')
# webbrowser.open_new_tab(url)
subprocess.call(browser+url) def OpenUnityFunctionReference(text):
# url = 'http://unity3d.com/support/documentation/ScriptReference/' + text.replace(' ','%20')
url = 'file:///D:/Program%20Files%20(x86)/Unity/Editor/Data/Documentation/Documentation/ScriptReference/' + text.replace(' ','%20') + '.html'
# webbrowser.open_new_tab(url)
subprocess.call(browser+url)

接着,可以绑定快捷键,ctrl+shift+p -> key bindings user,添加如下快捷键:

{ "keys": ["f4"], "command": "unity_reference_search_selection" }

Unity 语法高亮以及代码片

Unity 提供了一整套完善的游戏开发套件,在写代码的过程中,会遇到很多类是 Unity 自带的,有些类则是 C# 语言本身支持的,为此,网上有达人做了一份 Unity C# 语言高亮文件,里面会将 Unity 自带的类进行单独的高亮。不过我并不喜欢那个高亮的颜色,所以我自己并没有用,插件名称:Unity3D。

同语法高亮类似,也有达人做了一份为 Unity 量身打造的代码片断插件,下载安装相应的插件即中:Unity3D Snippets and Completes。

还有一个神奇的插件:Unity Completions,为什么说神奇呢,因为这个插件我安装就花了1个多小时,安装完后发现整个目录占用了200多M,文件大小20多M,光看这个要吓尿了,其他插件能有顶多有个几百K而已,再看看文件,大概有7W多个,怪不得占用这么大,但老实说这个插件我试了一下之后并不觉得好用,有兴趣的童鞋可以试试。

参考文章

用sublime text2寫unity3d c# script
Unity completions for Sublime Text
Using Sublime Text 2 With Unity3D
Using Sublime Text 2 With Unity3D – Part 2
Using Unity with Sublime Text 2 (How to get everything set up)

欢迎补充~

使用 Sublime Text 2 开发 Unity3D 项目的更多相关文章

  1. Sublime Text 前端开发常用扩展插件推荐

    Sublime Text 前端开发常用扩展插件推荐 Sublime Text Sublime Text 是程序员们公认的编码神奇,拥有漂亮的用户界面和强大的功能 更重要的是,Sublime Text ...

  2. Python 学习之中的一个:在Mac OS X下基于Sublime Text搭建开发平台包括numpy,scipy

    1 前言 Python有许多IDE能够用,官方自己也带了一个,Eclipse也能够. 但我在使用各种IDE之后,发现用Sublime Text是最好用的一个.因此.我都是用Sublime Text来编 ...

  3. Sublime Text前端开发工具介绍

    Sublime Text前端开发工具介绍.. Sublime Text这款前端开发工具中的非常优秀的特性进行介绍 ------------ sublime text 3 3114 注册码 —– BEG ...

  4. Python开发工具之Sublime Text 3基于文件创建项目

    说明: 本地windows系统 本地已安装Sublime Text 3; 本地已创建python项目文件,如test,并在该文件夹下创建了虚拟环境venv(test/venv). 1.创建项目 依次鼠 ...

  5. Sublime Text前端开发环境配置

    Sublime Text是前端开发不可不说的编辑器,本文以Sublime Text 3为例讲解一下如何搭建前端的开发环境. 下载Sublime Text 3 下载地址 #==> Sublime ...

  6. sublime text 前端开发插件安装和配置

    前端开发sublimeconfig mac配置 此文件目录中文件主要是关于sublime的插件配置,快捷键配置,主题和字体配置. 插件列表 所有插件都可以使用Package Control安装,具体的 ...

  7. Sublime Text web开发神器

    开发工具介绍 开发工具一般分为两种类型:文本编辑器和集成开发环境(IDE) 常用的文本编辑器:Sublime Text.Notepad++.EditPlus等 常用的IDE:WebStorm.Inte ...

  8. Mac下使用sublime text 2开发Python

    入门虽易, 熟练不易, 且行且珍惜 简介:这只是简单介绍一个好的文本工具sublime text的使用,如果要获得详细的教程可以去看这本书<Sublime Productivity>和一些 ...

  9. windows下配置Sublime Text 2开发Nodejs

    1 下载 Sublime Text 2 http://www.sublimetext.com/ 2 下载Nodejs插件,下载ZIP包 https://github.com/tanepiper/Sub ...

随机推荐

  1. CSS3 Border-image

    CSS3中有关于border的属性我们一起学习完了圆角border-radius和边框颜色border-color,只剩下最后一个边框图片border-image.今天我们就一起来学习这个border ...

  2. exp_tools

    #pwntools # github https://github.com/Gallopsled/pwntools 在线帮助文档 https://docs.pwntools.com/en/stable ...

  3. Js控制Div在浏览器中的高度

    //需求是,我需要通过浏览器内容可视化的高度来控制div的高度boxheight(); //执行函数function boxheight(){ //函数:获取尺寸 //获取浏览器窗口高度 var wi ...

  4. vue-cli 安装报错

    # 全局安装 vue-cli $ npm install --global vue-cli # 创建一个基于 webpack 模板的新项目 $ vue init webpack my-project ...

  5. ffmpeg centos6.5上安装(测试 amr 转换为 mp3)

    1. 下载相关源码包 wget http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz wget http://sourcefo ...

  6. Selenium的PO模式(Page Object Model)|(Selenium Webdriver For Python)

            研究Selenium + python 自动化测试有近两个月了,不能说非常熟练,起码对selenium自动化的执行有了深入的认识. 从最初无结构的代码,到类的使用,方法封装,从原始函数 ...

  7. python网络编程-socket

    python提供了两个socket模块 Socket,它提供了标准的BSD Sockets API SocketServer,它提供了服务器中心类,可以简化网络服务器的开发 下面先说socket模块 ...

  8. Intellij jrebel 热部署

    Intellij 14破解下载 注册机 即可进行破解.JRebel安装下载IntelliJ IDEA的 JRebel插件: jr-ide-idea-6.2.0-idea-13-14.zip. 打开In ...

  9. java(2)之前往对象村

    这次说一说面向对象与面向过程的区别以及面向对象的优点.

  10. Bootstrap_媒体对象

    一.基本媒体对象 媒体对象一般是成组出现,而一组媒体对象常常包括以下几个部分: ☑ 媒体对像的容器:常使用“media”类名表示,用来容纳媒体对象的所有内容 ☑ 媒体对像的对象:常使用“media-o ...