本文整理汇总了C#中UnityEditor.MonoScript类的典型用法代码示例。如果您正苦于以下问题:C# MonoScript类的具体用法?C# MonoScript怎么用?C# MonoScript使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MonoScript类属于UnityEditor命名空间,在下文中一共展示了MonoScript类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Init
private void Init(MonoScript script)
{
this.m_Initialized = true;
this.m_ScriptClass = script.GetClass();
this.m_NetworkChannelLabel = new GUIContent("Network Channel", "QoS channel used for updates. Use the [NetworkSettings] class attribute to change this.");
this.m_NetworkSendIntervalLabel = new GUIContent("Network Send Interval", "Maximum update rate in seconds. Use the [NetworkSettings] class attribute to change this, or implement GetNetworkSendInterval");
foreach (System.Reflection.FieldInfo info in this.m_ScriptClass.GetFields(BindingFlags.Public | BindingFlags.Instance))
{
Attribute[] customAttributes = (Attribute[]) info.GetCustomAttributes(typeof(SyncVarAttribute), true);
if (customAttributes.Length > 0)
{
this.m_SyncVarNames.Add(info.Name);
}
}
MethodInfo method = script.GetClass().GetMethod("OnSerialize");
if ((method != null) && (method.DeclaringType != typeof(NetworkBehaviour)))
{
this.m_HasOnSerialize = true;
}
int num2 = 0;
foreach (System.Reflection.FieldInfo info3 in base.serializedObject.targetObject.GetType().GetFields())
{
if ((info3.FieldType.BaseType != null) && info3.FieldType.BaseType.Name.Contains("SyncList"))
{
num2++;
}
}
if (num2 > 0)
{
this.m_ShowSyncLists = new bool[num2];
}
}
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:32,代码来源:NetworkBehaviourInspector.cs
示例2: ScriptNavigatorItemFor
private ScriptNavigatorItem ScriptNavigatorItemFor(MonoScript script, string path)
{
var fullPath = System.IO.Path.GetFullPath(path); // get extension
var fileName = System.IO.Path.GetFileName(fullPath);
var instanceID = script.GetInstanceID();
return new ScriptNavigatorItem(fileName, instanceID, FileNavigationService);
}
开发者ID:transformersprimeabcxyz,项目名称:_TO-DO-CodeEditor-Unity-Technologies,代码行数:7,代码来源:ScriptNavigatorItemProvider.cs
示例3: OnEnable
void OnEnable() {
if (!Application.isPlaying) {
monoScript = MonoScript.FromMonoBehaviour(script);
int currentExecutionOrder = MonoImporter.GetExecutionOrder(monoScript);
if (currentExecutionOrder != 10200) MonoImporter.SetExecutionOrder(monoScript, 10200);
}
}
开发者ID:cupsster,项目名称:ExtremeBusiness,代码行数:7,代码来源:CameraControllerInspector.cs
示例4: OnInspectorGUI
public override void OnInspectorGUI()
{
var proCamera2DTriggerInfluence = (ProCamera2DTriggerInfluence)target;
if(proCamera2DTriggerInfluence.ProCamera2D == null)
EditorGUILayout.HelpBox("ProCamera2D is not set.", MessageType.Error, true);
serializedObject.Update();
// Show script link
GUI.enabled = false;
_script = EditorGUILayout.ObjectField("Script", _script, typeof(MonoScript), false) as MonoScript;
GUI.enabled = true;
// ProCamera2D
_tooltip = new GUIContent("Pro Camera 2D", "");
EditorGUILayout.PropertyField(serializedObject.FindProperty("ProCamera2D"), _tooltip);
// Update interval
_tooltip = new GUIContent("Update Interval", "Every X seconds detect collision. Smaller frequencies are more precise but also require more processing.");
EditorGUILayout.PropertyField(serializedObject.FindProperty("UpdateInterval"), _tooltip);
if (proCamera2DTriggerInfluence.UpdateInterval <= 0.01f)
proCamera2DTriggerInfluence.UpdateInterval = 0.01f;
// Trigger shape
_tooltip = new GUIContent("Trigger Shape", "");
EditorGUILayout.PropertyField(serializedObject.FindProperty("TriggerShape"), _tooltip);
// Focus point
_tooltip = new GUIContent("Focus Point", "If set, the focus point will be this instead of the center of the trigger");
EditorGUILayout.PropertyField(serializedObject.FindProperty("FocusPoint"), _tooltip);
// Influence smoothness
_tooltip = new GUIContent("Influence Smoothness", "How smoothly should the camera move towards the focus point?");
EditorGUILayout.PropertyField(serializedObject.FindProperty("InfluenceSmoothness"), _tooltip);
if (proCamera2DTriggerInfluence.InfluenceSmoothness < 0f)
proCamera2DTriggerInfluence.InfluenceSmoothness = 0f;
// Exclusive influence percentage
_tooltip = new GUIContent("Exclusive Influence Percentage", "After entering this area the camera will reach it's max zoom value");
EditorGUILayout.PropertyField(serializedObject.FindProperty("ExclusiveInfluencePercentage"), _tooltip);
// Trigger targets
EditorGUILayout.BeginHorizontal();
var tooltip = new GUIContent("Use Targets Mid Point", "If checked, the trigger will use the mid point of all your camera targets");
EditorGUILayout.PropertyField(serializedObject.FindProperty("UseTargetsMidPoint"), tooltip);
if (!proCamera2DTriggerInfluence.UseTargetsMidPoint)
{
tooltip = new GUIContent("Trigger Target", "The target to use instead of the mid point of all camera targets");
EditorGUILayout.PropertyField(serializedObject.FindProperty("TriggerTarget"), tooltip);
}
EditorGUILayout.EndHorizontal();
serializedObject.ApplyModifiedProperties();
}
开发者ID:maynull,项目名称:LeftRightXoX,代码行数:58,代码来源:ProCamera2DTriggerInfluenceEditor.cs
示例5: OnEnable
void OnEnable()
{
var proCamera2DCameraWindow = (ProCamera2DCameraWindow)target;
if(proCamera2DCameraWindow.ProCamera2D == null && Camera.main != null)
proCamera2DCameraWindow.ProCamera2D = Camera.main.GetComponent<ProCamera2D>();
_script = MonoScript.FromMonoBehaviour((ProCamera2DCameraWindow)target);
}
开发者ID:robstenzinger,项目名称:SuperTropicalActionBoating64,代码行数:9,代码来源:ProCamera2DCameraWindowEditor.cs
示例6: OnEnable
void OnEnable()
{
var proCamera2DTriggerInfluence = (ProCamera2DTriggerInfluence)target;
if(proCamera2DTriggerInfluence.ProCamera2D == null && Camera.main != null)
proCamera2DTriggerInfluence.ProCamera2D = Camera.main.GetComponent<ProCamera2D>();
_script = MonoScript.FromMonoBehaviour(proCamera2DTriggerInfluence);
}
开发者ID:CptMedo,项目名称:Mars,代码行数:9,代码来源:ProCamera2DTriggerInfluenceEditor.cs
示例7: OnEnable
void OnEnable()
{
var proCamera2DForwardFocus = (ProCamera2DForwardFocus)target;
if(proCamera2DForwardFocus.ProCamera2D == null && Camera.main != null)
proCamera2DForwardFocus.ProCamera2D = Camera.main.GetComponent<ProCamera2D>();
_script = MonoScript.FromMonoBehaviour((ProCamera2DForwardFocus)target);
}
开发者ID:robstenzinger,项目名称:SuperTropicalActionBoating64,代码行数:9,代码来源:ProCamera2DForwardFocusEditor.cs
示例8: OnEnable
void OnEnable()
{
var proCamera2DPixelPerfectSprite = (ProCamera2DPixelPerfectSprite)target;
if (proCamera2DPixelPerfectSprite.ProCamera2D == null && Camera.main != null)
proCamera2DPixelPerfectSprite.ProCamera2D = Camera.main.GetComponent<ProCamera2D>();
_script = MonoScript.FromMonoBehaviour(proCamera2DPixelPerfectSprite);
}
开发者ID:millwardesque,项目名称:TrainDevChallenge,代码行数:9,代码来源:ProCamera2DPixelPerfectSpriteEditor.cs
示例9: OnInspectorGUI
public override void OnInspectorGUI()
{
var proCamera2DForwardFocus = (ProCamera2DForwardFocus)target;
serializedObject.Update();
// Show script link
_script = EditorGUILayout.ObjectField("Script", _script, typeof(MonoScript), false) as MonoScript;
// ProCamera2D
_tooltip = new GUIContent("Pro Camera 2D", "");
EditorGUILayout.PropertyField(serializedObject.FindProperty("ProCamera2D"), _tooltip);
if(proCamera2DForwardFocus.ProCamera2D == null)
EditorGUILayout.HelpBox("ProCamera2D is not set.", MessageType.Error, true);
// Progressive
_tooltip = new GUIContent("Progressive", "Should the forward focus move progressively based on the camera speed or should it transition to the focus based on the direction.");
EditorGUILayout.PropertyField(serializedObject.FindProperty("Progressive"), _tooltip);
// Speed multiplier
if(proCamera2DForwardFocus.Progressive)
{
_tooltip = new GUIContent("Speed Multiplier", "Multiply the camera speed by this number. You probably only want to change this value if the camera speed is not sufficient to reach the target focus.");
EditorGUILayout.PropertyField(serializedObject.FindProperty("SpeedMultiplier"), _tooltip);
}
// Transition smoothness
_tooltip = new GUIContent("Transition smoothness", "How smoothly should the forward focus influence move?");
EditorGUILayout.PropertyField(serializedObject.FindProperty("TransitionSmoothness"), _tooltip);
if(proCamera2DForwardFocus.TransitionSmoothness < 0f) proCamera2DForwardFocus.TransitionSmoothness = 0f;
// Maintain Influence On Stop
_tooltip = new GUIContent("Maintain Influence On Stop", "Should the influence maintain after the camera stops?");
EditorGUILayout.PropertyField(serializedObject.FindProperty("MaintainInfluenceOnStop"), _tooltip);
// Left focus
_tooltip = new GUIContent("Left Focus", "How much should the camera compensate when moving left?");
EditorGUILayout.PropertyField(serializedObject.FindProperty("LeftFocus"), _tooltip);
// Right focus
_tooltip = new GUIContent("Right Focus", "How much should the camera compensate when moving right?");
EditorGUILayout.PropertyField(serializedObject.FindProperty("RightFocus"), _tooltip);
// Up focus
_tooltip = new GUIContent("Up Focus", "How much should the camera compensate when moving up?");
EditorGUILayout.PropertyField(serializedObject.FindProperty("TopFocus"), _tooltip);
// Down focus
_tooltip = new GUIContent("Down Focus", "How much should the camera compensate when moving down?");
EditorGUILayout.PropertyField(serializedObject.FindProperty("BottomFocus"), _tooltip);
serializedObject.ApplyModifiedProperties();
}
开发者ID:robstenzinger,项目名称:SuperTropicalActionBoating64,代码行数:56,代码来源:ProCamera2DForwardFocusEditor.cs
示例10: OnGUI
void OnGUI()
{
// CSV
TextAsset newCsv = EditorGUILayout.ObjectField("CSV", csv, typeof(TextAsset), false) as TextAsset;
if(newCsv != csv)
{
csv = newCsv;
if(csv != null)
arr = CsvParser2.Parse(csv.text);
else
arr = null;
}
// Script
script = EditorGUILayout.ObjectField("Script", script, typeof(MonoScript), false) as MonoScript;
// buttons
EditorGUILayout.BeginHorizontal();
if(GUILayout.Button("Refresh") && csv != null)
arr = CsvParser2.Parse(csv.text);
if(GUILayout.Button("Generate Code"))
{
string path = "";
if(script != null)
{
path = AssetDatabase.GetAssetPath(script);
}
else
{
path = EditorUtility.SaveFilePanel("Save Script", "Assets", csv.name + "Table.cs", "cs");
}
if(!string.IsNullOrEmpty(path))
script = CreateScript(csv, path);
}
EditorGUILayout.EndHorizontal();
// columns
if(arr != null)
{
foldout = EditorGUILayout.Foldout(foldout, "Columns");
if(foldout)
{
EditorGUI.indentLevel++;
if(csv != null && arr == null)
arr = CsvParser2.Parse(csv.text);
if(arr != null)
{
for(int i = 0 ; i < arr[0].Length ; i++)
{
EditorGUILayout.LabelField(arr[0][i]);
}
}
EditorGUI.indentLevel--;
}
}
}
开发者ID:samnau,项目名称:NoMansLand,代码行数:56,代码来源:CSV2Table.cs
示例11: OnEnable
void OnEnable() {
if (serializedObject == null) return;
// Changing the script execution order
if (!Application.isPlaying) {
monoScript = MonoScript.FromMonoBehaviour(script);
int currentExecutionOrder = MonoImporter.GetExecutionOrder(monoScript);
if (currentExecutionOrder != 10000) MonoImporter.SetExecutionOrder(monoScript, 10000);
}
}
开发者ID:paulkelly,项目名称:GGJ2016,代码行数:10,代码来源:FingerRigInspector.cs
示例12: OnInspectorGUI
public override void OnInspectorGUI()
{
var proCamera2DCameraWindow = (ProCamera2DCameraWindow)target;
if (proCamera2DCameraWindow.ProCamera2D == null)
{
EditorGUILayout.HelpBox("ProCamera2D is not set.", MessageType.Error, true);
return;
}
serializedObject.Update();
// Show script link
GUI.enabled = false;
_script = EditorGUILayout.ObjectField("Script", _script, typeof(MonoScript), false) as MonoScript;
GUI.enabled = true;
// ProCamera2D
_tooltip = new GUIContent("Pro Camera 2D", "");
EditorGUILayout.PropertyField(serializedObject.FindProperty("ProCamera2D"), _tooltip);
string hAxis = "";
string vAxis = "";
switch (proCamera2DCameraWindow.ProCamera2D.Axis)
{
case MovementAxis.XY:
hAxis = "X";
vAxis = "Y";
break;
case MovementAxis.XZ:
hAxis = "X";
vAxis = "Z";
break;
case MovementAxis.YZ:
hAxis = "Y";
vAxis = "Z";
break;
}
_tooltip = new GUIContent("Width", "Window width");
EditorGUILayout.Slider(serializedObject.FindProperty("CameraWindowRect.width"), 0f, 1f, _tooltip);
_tooltip = new GUIContent("Height", "Window height");
EditorGUILayout.Slider(serializedObject.FindProperty("CameraWindowRect.height"), 0f, 1f, _tooltip);
_tooltip = new GUIContent(hAxis, "Window horizontal offset");
EditorGUILayout.PropertyField(serializedObject.FindProperty("CameraWindowRect.x"), _tooltip);
_tooltip = new GUIContent(vAxis, "Window vertical offset");
EditorGUILayout.PropertyField(serializedObject.FindProperty("CameraWindowRect.y"), _tooltip);
serializedObject.ApplyModifiedProperties();
}
开发者ID:maynull,项目名称:LeftRightXoX,代码行数:55,代码来源:ProCamera2DCameraWindowEditor.cs
示例13: OnEnable
void OnEnable()
{
ProCamera2DEditorHelper.AssignProCamera2D(target as BasePC2D);
_script = MonoScript.FromMonoBehaviour((ProCamera2DTriggerRails)target);
var proCamera2DTriggerRails = (ProCamera2DTriggerRails)target;
if(proCamera2DTriggerRails.ProCamera2D != null && proCamera2DTriggerRails.ProCamera2DRails == null)
proCamera2DTriggerRails.ProCamera2DRails = proCamera2DTriggerRails.ProCamera2D.GetComponentInChildren<ProCamera2DRails>();
}
开发者ID:maynull,项目名称:LeftRightXoX,代码行数:11,代码来源:ProCamera2DTriggerRailsEditor.cs
示例14: IsCustomizableScript
private static bool IsCustomizableScript(MonoScript script)
{
bool isCustomizable = false;
Type scriptClass = script.GetClass();
if (scriptClass != null)
{
isCustomizable = scriptClass.IsSubclassOf(typeof(MonoBehaviour)) || scriptClass.IsSubclassOf(typeof(ScriptableObject));
}
return isCustomizable;
}
开发者ID:Doy32,项目名称:Samurai,代码行数:12,代码来源:UICreatorContext.cs
示例15: LoadMonoScript
static MonoScript _mono_pe; ///< MonoScript assets
/**
* Load the pb_Object and pb_Entity classes to MonoScript assets. Saves us from having to fall back on Reflection.
*/
static void LoadMonoScript()
{
GameObject go = new GameObject();
pb_Object pb = go.AddComponent<pb_Object>();
pb_Entity pe = go.AddComponent<pb_Entity>();
_mono_pb = MonoScript.FromMonoBehaviour( pb );
_mono_pe = MonoScript.FromMonoBehaviour( pe );
DestroyImmediate(go);
}
开发者ID:ianburnette,项目名称:MarshBirds,代码行数:17,代码来源:pb_MissingScriptEditor.cs
示例16: OnInspectorGUI
public override void OnInspectorGUI()
{
var proCamera2DTriggerRails = (ProCamera2DTriggerRails)target;
if(proCamera2DTriggerRails.ProCamera2D == null)
EditorGUILayout.HelpBox("ProCamera2D is not set.", MessageType.Error, true);
serializedObject.Update();
// Show script link
GUI.enabled = false;
_script = EditorGUILayout.ObjectField("Script", _script, typeof(MonoScript), false) as MonoScript;
GUI.enabled = true;
// ProCamera2D
_tooltip = new GUIContent("Pro Camera 2D", "");
EditorGUILayout.PropertyField(serializedObject.FindProperty("ProCamera2D"), _tooltip);
// Update interval
_tooltip = new GUIContent("Update Interval", "Every X seconds detect collision. Smaller frequencies are more precise but also require more processing.");
EditorGUILayout.PropertyField(serializedObject.FindProperty("UpdateInterval"), _tooltip);
if (proCamera2DTriggerRails.UpdateInterval <= 0.01f)
proCamera2DTriggerRails.UpdateInterval = 0.01f;
// Trigger shape
_tooltip = new GUIContent("Trigger Shape", "");
EditorGUILayout.PropertyField(serializedObject.FindProperty("TriggerShape"), _tooltip);
// Trigger targets
EditorGUILayout.BeginHorizontal();
_tooltip = new GUIContent("Use Targets Mid Point", "If checked, the trigger will use the mid point of all your camera targets");
EditorGUILayout.PropertyField(serializedObject.FindProperty("UseTargetsMidPoint"), _tooltip);
if (!proCamera2DTriggerRails.UseTargetsMidPoint)
{
_tooltip = new GUIContent("Trigger Target", "The target to use instead of the mid point of all camera targets");
EditorGUILayout.PropertyField(serializedObject.FindProperty("TriggerTarget"), _tooltip);
}
EditorGUILayout.EndHorizontal();
// Mode
_tooltip = new GUIContent("Mode", "Choose if you want this trigger to enable or disable the rails.");
EditorGUILayout.PropertyField(serializedObject.FindProperty("Mode"), _tooltip);
// Transition Duration
_tooltip = new GUIContent("Transition Duration", "The time it should take to transition from/to rails.");
EditorGUILayout.PropertyField(serializedObject.FindProperty("TransitionDuration"), _tooltip);
serializedObject.ApplyModifiedProperties();
}
开发者ID:maynull,项目名称:LeftRightXoX,代码行数:52,代码来源:ProCamera2DTriggerRailsEditor.cs
示例17: OnEnable
void OnEnable()
{
ProCamera2DEditorHelper.AssignProCamera2D(target as BasePC2D);
var proCamera2DTriggerBoundaries = (ProCamera2DTriggerBoundaries)target;
if (proCamera2DTriggerBoundaries.NumericBoundaries == null && proCamera2DTriggerBoundaries.ProCamera2D != null)
{
var numericBoundaries = proCamera2DTriggerBoundaries.ProCamera2D.GetComponent<ProCamera2DNumericBoundaries>();
proCamera2DTriggerBoundaries.NumericBoundaries = numericBoundaries == null ? proCamera2DTriggerBoundaries.ProCamera2D.gameObject.AddComponent<ProCamera2DNumericBoundaries>() : numericBoundaries;
}
_script = MonoScript.FromMonoBehaviour(proCamera2DTriggerBoundaries);
}
开发者ID:millwardesque,项目名称:TrafficSurfer,代码行数:14,代码来源:ProCamera2DTriggerBoundariesEditor.cs
示例18: OnEnable
void OnEnable() {
if (serializedObject == null) return;
// Changing the script execution order
if (!Application.isPlaying) {
int executionOrder = 0;
monoScript = MonoScript.FromMonoBehaviour(GetMonoBehaviour(out executionOrder));
int currentExecutionOrder = MonoImporter.GetExecutionOrder(monoScript);
if (currentExecutionOrder != executionOrder) MonoImporter.SetExecutionOrder(monoScript, executionOrder);
}
solver = serializedObject.FindProperty("solver");
timeStep = new SerializedContent(serializedObject.FindProperty("timeStep"), new GUIContent("Time Step", "If zero, will update the solver in every LateUpdate(). Use this for chains that are animated. If > 0, will be used as updating frequency so that the solver will reach its target in the same time on all machines."));
fixTransforms = new SerializedContent(serializedObject.FindProperty("fixTransforms"), new GUIContent("Fix Transforms", "If true, will fix all the Transforms used by the solver to their initial state in each Update. This prevents potential problems with unanimated bones and animator culling with a small cost of performance. Not recommended for CCD and FABRIK solvers."));
OnEnableVirtual();
}
开发者ID:paulkelly,项目名称:GGJ2016,代码行数:17,代码来源:IKInspector.cs
示例19: MonoScriptIconChanged
public void MonoScriptIconChanged(MonoScript monoScript)
{
if ((UnityEngine.Object) monoScript == (UnityEngine.Object) null)
return;
bool flag = true;
using (List<MonoScript>.Enumerator enumerator = this.m_MonoScriptIconsChanged.GetEnumerator())
{
while (enumerator.MoveNext())
{
if (enumerator.Current.GetInstanceID() == monoScript.GetInstanceID())
flag = false;
}
}
if (!flag)
return;
this.m_MonoScriptIconsChanged.Add(monoScript);
}
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:17,代码来源:AnnotationWindow.cs
示例20: GetClassName
private string GetClassName(MCP_AI.AgentAI.OPTIONS option,MonoScript ms)
{
switch (option)
{
case MCP_AI.AgentAI.OPTIONS.FSMAI:
return typeof(FSM.FSMAI).Name;
case MCP_AI.AgentAI.OPTIONS.BTAI:
return typeof(BT.BTAI).Name;
case MCP_AI.AgentAI.OPTIONS.RandomAI:
return typeof(RandomAI).Name;
case MCP_AI.AgentAI.OPTIONS.CustomAI:
return ms.GetClass().Name;
}
return null;
}
开发者ID:valentincr,项目名称:MCP20132014,代码行数:18,代码来源:ControllerEditor.cs
注:本文中的UnityEditor.MonoScript类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论