本文整理汇总了C#中UnityEditor.MenuCommand类的典型用法代码示例。如果您正苦于以下问题:C# MenuCommand类的具体用法?C# MenuCommand怎么用?C# MenuCommand使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MenuCommand类属于UnityEditor命名空间,在下文中一共展示了MenuCommand类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: BackupTransform
public static void BackupTransform(MenuCommand command)
{
if (command.context is Component) {
var component = (Component)command.context;
fiBackupManager.CreateBackup(component);
}
}
开发者ID:jacobdufault,项目名称:fullinspector,代码行数:7,代码来源:fiContextMenus.cs
示例2: PasteComponentAsNew
static void PasteComponentAsNew( MenuCommand command )
{
TileComponent component = command.context as TileComponent;
Tile tile = component.tile;
TileComponentUtility.PasteComponentAsNew( tile );
}
开发者ID:sgmtjp,项目名称:Git-SODATERUTOWER,代码行数:7,代码来源:TileComponentContextMenu.cs
示例3: BackupBaseBehavior
public static void BackupBaseBehavior(MenuCommand command)
{
if (command.context is Component) {
var component = (Component)command.context;
fiBackupManager.CreateBackup(component);
}
}
开发者ID:jacobdufault,项目名称:fullinspector,代码行数:7,代码来源:fiContextMenus.cs
示例4: CreateGameObjectAsChild
static void CreateGameObjectAsChild (MenuCommand command)
{
Transform tr = (Transform)command.context;
GameObject go = new GameObject ("Locator_");
go.transform.parent = tr;
go.transform.localPosition = Vector3.zero;
}
开发者ID:maruton,项目名称:Sample_Fade,代码行数:7,代码来源:CreateLocatorHere.cs
示例5: BatchTargets
private static void BatchTargets(MenuCommand aCommand)
{
BatchingUtil batcher = aCommand.context as BatchingUtil;
if(batcher == null)
{
return;
}
List<GameObject> targets = new List<GameObject>();
IEnumerator iter = batcher.transform.GetEnumerator();
while(iter.MoveNext())
{
Transform transform = iter.Current as Transform;
if(transform == null)
{
DebugUtils.LogWarning("Missing transform while trying to batch targets.");
continue;
}
if(transform.renderer != null)
{
targets.Add(transform.gameObject);
}
}
batcher.m_Targets = targets.ToArray();
EditorUtility.SetDirty(batcher);
}
开发者ID:NathanSaidas,项目名称:OnLooker_Unity,代码行数:26,代码来源:BatchingUtil.cs
示例6: SubmitTest
private static bool SubmitTest(MenuCommand cmd)
{
AssetList listFromSelection = Provider.GetAssetListFromSelection();
if (Provider.enabled)
return Provider.SubmitIsValid((ChangeSet) null, listFromSelection);
return false;
}
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:7,代码来源:ProjectContextMenu.cs
示例7: CheckOutBothTest
private static bool CheckOutBothTest(MenuCommand cmd)
{
AssetList listFromSelection = Provider.GetAssetListFromSelection();
if (Provider.enabled)
return Provider.CheckoutIsValid(listFromSelection, CheckoutMode.Both);
return false;
}
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:7,代码来源:ProjectContextMenu.cs
示例8: PasteMaterialProperties
static void PasteMaterialProperties(MenuCommand command)
{
if (m_copiedProperties == null)
{
Debug.LogWarning("No Material Properties to Paste. Use Copy Material Properties first.");
return;
}
Material mat = (Material)command.context;
Undo.RecordObject(mat, "Paste Material");
if (mat.HasProperty(ShaderUtilities.ID_GradientScale))
{
// Preserve unique SDF properties from destination material.
m_copiedProperties.SetTexture(ShaderUtilities.ID_MainTex, mat.GetTexture(ShaderUtilities.ID_MainTex));
m_copiedProperties.SetFloat(ShaderUtilities.ID_GradientScale, mat.GetFloat(ShaderUtilities.ID_GradientScale));
m_copiedProperties.SetFloat(ShaderUtilities.ID_TextureWidth, mat.GetFloat(ShaderUtilities.ID_TextureWidth));
m_copiedProperties.SetFloat(ShaderUtilities.ID_TextureHeight, mat.GetFloat(ShaderUtilities.ID_TextureHeight));
}
EditorShaderUtilities.CopyMaterialProperties(m_copiedProperties, mat);
// Copy ShaderKeywords from one material to the other.
mat.shaderKeywords = m_copiedProperties.shaderKeywords;
// Let TextMeshPro Objects that this mat has changed.
TMPro_EventManager.ON_MATERIAL_PROPERTY_CHANGED(true, mat);
}
开发者ID:koko11,项目名称:MatrixVR,代码行数:29,代码来源:TMPro_ContextMenus.cs
示例9: GetLatestTest
private static bool GetLatestTest(MenuCommand cmd)
{
AssetList listFromSelection = Provider.GetAssetListFromSelection();
if (Provider.enabled)
return Provider.GetLatestIsValid(listFromSelection);
return false;
}
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:7,代码来源:ProjectContextMenu.cs
示例10: CreateGameObjectContext
public static void CreateGameObjectContext(MenuCommand menuCommand)
{
var root = new GameObject("GameObjectContext").AddComponent<GameObjectContext>();
Selection.activeGameObject = root.gameObject;
EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
}
开发者ID:Soren025,项目名称:Zenject,代码行数:7,代码来源:ZenMenuItems.cs
示例11: CreateBone
public static void CreateBone(MenuCommand menuCommand)
{
GameObject bone = new GameObject("New bone");
Bone2D boneComponent = bone.AddComponent<Bone2D>();
Undo.RegisterCreatedObjectUndo(bone, "Create bone");
bone.transform.position = GetDefaultInstantiatePosition();
GameObject selectedGO = Selection.activeGameObject;
if(selectedGO)
{
bone.transform.parent = selectedGO.transform;
Vector3 localPosition = bone.transform.localPosition;
localPosition.z = 0f;
bone.transform.localPosition = localPosition;
bone.transform.localRotation = Quaternion.identity;
bone.transform.localScale = Vector3.one;
Bone2D selectedBone = selectedGO.GetComponent<Bone2D>();
if(selectedBone)
{
if(!selectedBone.child)
{
bone.transform.position = selectedBone.endPosition;
selectedBone.child = boneComponent;
}
}
}
Selection.activeGameObject = bone;
}
开发者ID:Kundara,项目名称:project1,代码行数:35,代码来源:ContextMenu.cs
示例12: ContextCreateSpriteMesh
static void ContextCreateSpriteMesh(MenuCommand menuCommand)
{
GameObject spriteRendererGO = Selection.activeGameObject;
SpriteRenderer spriteRenderer = null;
SpriteMesh spriteMesh = null;
if(spriteRendererGO)
{
spriteRenderer = spriteRendererGO.GetComponent<SpriteRenderer>();
}
if(spriteRenderer &&
spriteRenderer.sprite)
{
SpriteMesh overrideSpriteMesh = SpriteMeshPostprocessor.GetSpriteMeshFromSprite(spriteRenderer.sprite);
if(overrideSpriteMesh)
{
spriteMesh = overrideSpriteMesh;
}else{
spriteMesh = SpriteMeshUtils.CreateSpriteMesh(spriteRenderer.sprite);
}
}
if(spriteMesh)
{
Undo.SetCurrentGroupName("create SpriteMeshInstance");
Undo.DestroyObjectImmediate(spriteRenderer);
SpriteMeshUtils.CreateSpriteMeshInstance(spriteMesh,spriteRendererGO,true);
Selection.activeGameObject = spriteRendererGO;
}else{
Debug.Log("Select a SpriteRenderer with a Sprite to convert to SpriteMesh");
}
}
开发者ID:Kundara,项目名称:project1,代码行数:35,代码来源:ContextMenu.cs
示例13: CopyAtlas
static void CopyAtlas(MenuCommand command)
{
Material mat = command.context as Material;
m_copiedAtlasProperties = new Material(mat);
m_copiedAtlasProperties.hideFlags = HideFlags.DontSave;
}
开发者ID:Reticulatas,项目名称:Embargo,代码行数:7,代码来源:TMPro_ContextMenus.cs
示例14: DoFind
private static void DoFind(MenuCommand data)
{
var script = Selection.activeObject as MonoScript;
if (script == null) return;
var klass = script.GetClass();
if (typeof(Component).IsAssignableFrom(klass))
{
if (_window == null)
{
_window = EditorWindow.GetWindow<ComponentSearchWindow>();
_window._mode = 0;
_window._targetScript = script;
_window._forceRefresh = true;
_window.Show();
_window.position = new Rect(20, 80, 500, 300);
}
else
{
_window._mode = 0;
_window._targetScript = script;
_window._forceRefresh = true;
_window.Focus();
}
}
}
开发者ID:yuanchunfa,项目名称:spacepuppy-unity-framework,代码行数:26,代码来源:ComponentSearchWindow.cs
示例15: CreatePulse
public static void CreatePulse(MenuCommand menuCommand)
{
var pulse = new GameObject("Pulse", typeof(Pulse));
GameObjectUtility.SetParentAndAlign(pulse, menuCommand.context as GameObject);
Undo.RegisterCreatedObjectUndo(pulse, "Create " + pulse.name);
Selection.activeGameObject = pulse;
}
开发者ID:CarlosMeloStuff,项目名称:PulseSequencer,代码行数:7,代码来源:PulseEditorHelpers.cs
示例16: CreatePattern
public static void CreatePattern(MenuCommand menuCommand)
{
var pattern = new GameObject("Pattern", typeof(Pattern));
GameObjectUtility.SetParentAndAlign(pattern, menuCommand.context as GameObject);
Undo.RegisterCreatedObjectUndo(pattern, "Create " + pattern.name);
Selection.activeGameObject = pattern;
}
开发者ID:CarlosMeloStuff,项目名称:PulseSequencer,代码行数:7,代码来源:PulseEditorHelpers.cs
示例17: initializeARScene
static void initializeARScene(MenuCommand cmd)
{
GameObject go = new GameObject("ARScene");
go.AddComponent<ARSceneBehaviour>();
go.transform.position = Vector3.zero;
go.transform.rotation = Quaternion.identity;
}
开发者ID:polycular,项目名称:oekogotschi,代码行数:7,代码来源:ARSceneBehaviourEditor.cs
示例18: RemoveDetailCheck
internal static bool RemoveDetailCheck(MenuCommand item)
{
Terrain context = (Terrain) item.context;
if (item.userData >= 0)
return item.userData < context.terrainData.detailPrototypes.Length;
return false;
}
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:7,代码来源:TerrainDetailContextMenus.cs
示例19: AddInputField
public static void AddInputField(MenuCommand menuCommand)
{
GameObject inputFieldGO = DefaultControls.CreateInputField(GetStandardResources());
InputField inputField = inputFieldGO.GetComponent<InputField>();
var textChild = inputFieldGO.transform.FindChild("Text").gameObject;
var text = textChild.GetComponent<Text>();
Object.DestroyImmediate(text);
UnivText unvText = textChild.AddComponent<UnivText>();
unvText.text = "";
unvText.color = Color.black;
unvText.supportRichText = false;
inputField.textComponent = unvText;
var placeholderChild = inputFieldGO.transform.FindChild("Placeholder").gameObject;
var placeholderText = placeholderChild.GetComponent<Text>();
Object.DestroyImmediate(placeholderText);
UnivText placeholderUnvText = placeholderChild.AddComponent<UnivText>();
placeholderUnvText.text = "הכנס טקסט...";
placeholderUnvText.fontStyle = FontStyle.Italic;
// Make placeholder color half as opaque as normal text color.
Color placeholderColor = unvText.color;
placeholderColor.a *= 0.5f;
placeholderUnvText.color = placeholderColor;
inputField.placeholder = placeholderUnvText;
PlaceUIElementRoot(inputFieldGO, menuCommand);
}
开发者ID:TheAnosmic,项目名称:UnityUnivInput,代码行数:29,代码来源:UnivTextEditor.cs
示例20: EditDetail
internal static void EditDetail(MenuCommand item)
{
if (((Terrain) item.context).terrainData.detailPrototypes[item.userData].usePrototypeMesh)
TerrainWizard.DisplayTerrainWizard<DetailMeshWizard>("Edit Detail Mesh", "Apply").InitializeDefaults((Terrain) item.context, item.userData);
else
TerrainWizard.DisplayTerrainWizard<DetailTextureWizard>("Edit Grass Texture", "Apply").InitializeDefaults((Terrain) item.context, item.userData);
}
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:7,代码来源:TerrainDetailContextMenus.cs
注:本文中的UnityEditor.MenuCommand类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论