本文整理汇总了C#中UnityEngine.Object类的典型用法代码示例。如果您正苦于以下问题:C# Object类的具体用法?C# Object怎么用?C# Object使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Object类属于UnityEngine命名空间,在下文中一共展示了Object类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnGUI
public override void OnGUI(Object actionObj)
{
StateChangeAction action = actionObj as StateChangeAction;
if (action == null) { GUILayout.Label("Error: Delete this Action."); return; }
EditorGUILayout.BeginHorizontal();
{
action.setState = (0 == EditorGUILayout.Popup((action.setState ? 0 : 1), options));
UniRPGEdGui.TargetTypeField(this.ed, "on", action.subject, TargetTypeHelp);
GUILayout.FlexibleSpace();
}
EditorGUILayout.EndHorizontal();
GUILayout.Space(15);
scroll = UniRPGEdGui.BeginScrollView(scroll, UniRPGEdGui.ScrollViewNoTLMarginStyle, GUILayout.Height(200));
for (int i = 0; i < UniRPGEditorGlobal.DB.states.Count; i++)
{
if (UniRPGEdGui.ToggleButton(UniRPGEditorGlobal.DB.states[i] == action.state, UniRPGEditorGlobal.DB.states[i].screenName, EditorStyles.miniButton, UniRPGEdGui.ButtonOnColor, GUILayout.Width(270)))
{
action.state = UniRPGEditorGlobal.DB.states[i];
}
}
UniRPGEdGui.EndScrollView();
showAcceptButton = (action.state != null);
}
示例2: ActionShortNfo
public override string ActionShortNfo(Object actionObj)
{
DebugLogAction action = actionObj as DebugLogAction;
if (action == null) return "!ERROR!";
if (action.inclNum) return string.Format("Debug: {0} ({1})", action.text.GetValOrName(), action.num.GetValOrName());
else return string.Format("Debug: {0}", action.text.GetValOrName());
}
示例3: Object
public override UnityObject Object(GUIContent content, UnityObject value, System.Type type, bool allowSceneObjects, Layout option)
{
// If we pass an empty content, ObjectField will still reserve space for an empty label ~__~
return string.IsNullOrEmpty(content.text) ?
EditorGUILayout.ObjectField(value, type, allowSceneObjects, option) :
EditorGUILayout.ObjectField(content, value, type, allowSceneObjects, option);
}
示例4: ActionShortNfo
public override string ActionShortNfo(Object actionObj)
{
StateChangeAction action = actionObj as StateChangeAction;
if (action == null) return "!ERROR!";
if (action.state) return string.Format("{0} State ({1}) on {2}", (action.setState ? "Set" : "Clear"), action.state.screenName, action.subject.type);
else return string.Format("Set/Clear State (!ERROR!) on {0}", action.subject.type);
}
示例5: Register
public void Register( Object owner, Action action )
{
actionList.AddLast( new EventSubscriber {
action = action,
owner = owner
} );
}
示例6: Initialize
public override void Initialize(Object[] targets)
{
base.Initialize(targets);
this.GetNetworkInformation(this.target as NetworkManager);
this.m_ShowServerMessagesLabel = new GUIContent("Server Message Handlers:", "Registered network message handler functions");
this.m_ShowClientMessagesLabel = new GUIContent("Client Message Handlers:", "Registered network message handler functions");
}
示例7: GetAssetPath
/// <summary>
/// Gets the asset path of a object.
/// </summary>
/// <returns>The asset path.</returns>
/// <param name="obj">Object.</param>
public static string GetAssetPath(Object obj)
{
if (obj == null)
return string.Empty;
return AssetDatabase.GetAssetPath(obj);
}
示例8: ActionShortNfo
public override string ActionShortNfo(Object actionObj)
{
SoundAction action = actionObj as SoundAction;
if (action.doWhat == 0) return "Start Sound or Music";
if (action.doWhat == 1) return "Play Target Sound";
return "Stop Target Sound";
}
示例9: ActionShortNfo
public override string ActionShortNfo(Object actionObj)
{
SendMessageAction action = actionObj as SendMessageAction;
if (action == null) return "!ERROR!";
if (action.sendToTaggedObjects) return string.Format("SendMessage ({0}) to all with tag: {1}", action.functionName, action.tagToUse);
else return string.Format("SendMessage ({0}) to: {1}", action.functionName, action.subject);
}
示例10: UniqueObject
public UniqueObject( Object obj )
{
#if USE_STRONG_EDITOR_REFS
editorLocalId = 0;
#endif
scene = new AmsSceneReference();
fullPath = string.Empty;
componentName = string.Empty;
version = CurrentSerializedVersion;
componentIndex = 0;
if ( !obj )
return;
GameObject gameObject = GameObjectEx.EditorGetGameObjectFromComponent( obj );
if ( gameObject )
{
scene = new AmsSceneReference( gameObject.scene );
fullPath = gameObject.GetFullName();
Component comp = obj as Component;
if ( comp )
{
componentName = obj.GetType().AssemblyQualifiedName;
gameObject.GetComponents( obj.GetType(), _reusableComponentsList );
componentIndex = _reusableComponentsList.IndexOf( comp );
}
}
#if USE_STRONG_EDITOR_REFS
editorLocalId = GetEditorId( obj );
#endif
}
示例11: RegisterCreatedObjectUndo
public static void RegisterCreatedObjectUndo(Object obj, string msg)
{
#if PB_DEBUG
Debug.Log("RegisterCreatedObjectUndo() -> " + msg);
#endif
Undo.RegisterCreatedObjectUndo(obj, msg);
}
示例12: DestroyImmediate
/**
* Record object prior to deletion.
*/
public static void DestroyImmediate(Object obj, string msg)
{
#if PB_DEBUG
Debug.Log("DestroyImmediate() -> " + msg);
#endif
Undo.DestroyObjectImmediate(obj);
}
示例13: RegisterCompleteObjectUndo
/**
* Undo.RegisterCompleteObjectUndo
*/
public static void RegisterCompleteObjectUndo(Object[] objs, string msg)
{
#if PB_DEBUG
Debug.Log("RegisterCompleteObjectUndo() -> " + msg);
#endif
Undo.RegisterCompleteObjectUndo(objs, msg);
}
示例14: RecordObject
/**
* Record an object for Undo.
*/
public static void RecordObject(Object obj, string msg)
{
#if PB_DEBUG
Debug.Log("RecordObject() -> " + msg);
#endif
Undo.RecordObject(obj, msg);
}
示例15: CopyAndRenameAsset
public static bool CopyAndRenameAsset(Object obj, string newName, string newFolderPath)
{
#if UNITY_EDITOR
string path = newFolderPath;
if(path[path.Length - 1] != '/')
path += "/";
string testPath = path.Remove(path.Length - 1);
// if(AssetDatabase.IsValidFolder(testPath) == false)
// {
// Debug.LogError("This folder does not exist " + testPath);
// return false;
// }
string assetPath = AssetDatabase.GetAssetPath(obj);
string fileName = GetFileName(assetPath);
string extension = fileName.Remove(0, fileName.LastIndexOf('.'));
string newFileName = path + newName + extension;
if(System.IO.File.Exists(newFileName))
return false;
return AssetDatabase.CopyAsset(assetPath, newFileName);
#else
return false;
#endif
}