本文整理汇总了C#中UnityEngine.GetInstanceID方法的典型用法代码示例。如果您正苦于以下问题:C# UnityEngine.GetInstanceID方法的具体用法?C# UnityEngine.GetInstanceID怎么用?C# UnityEngine.GetInstanceID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine
的用法示例。
在下文中一共展示了UnityEngine.GetInstanceID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RegisterGameObj
public static AKRESULT RegisterGameObj(UnityEngine.GameObject in_gameObjectID, string in_pszObjName) {
AKRESULT res = RegisterGameObjInternal_WithName((int)in_gameObjectID.GetInstanceID(), in_gameObjectID.name);
if( res == AKRESULT.AK_Success )
{
RegisteredGameObjects.Add(in_gameObjectID.GetInstanceID());
}
return res;
}
示例2: RegisterGameObj
public static AKRESULT RegisterGameObj(UnityEngine.GameObject in_gameObjectID) {
if (!AkSoundEngine.IsInitialized())
return AKRESULT.AK_Fail;
AKRESULT res = RegisterGameObjInternal((int)in_gameObjectID.GetInstanceID());
if( res == AKRESULT.AK_Success )
{
RegisteredGameObjects.Add(in_gameObjectID.GetInstanceID());
}
return res;
}
示例3: DynamicSequenceOpen
public static uint DynamicSequenceOpen(UnityEngine.GameObject in_gameObjectID, uint in_uFlags, AkCallbackManager.EventCallback in_pfnCallback, object in_pCookie) {
uint tempin_gameObjectID;
if ( in_gameObjectID != null )
{
tempin_gameObjectID = (uint)in_gameObjectID.GetInstanceID();
// Note: if AkGameObjectTracker is already attached, the following code will be bypassed.
if (in_gameObjectID.GetComponent<AkGameObject>() == null)
{
in_gameObjectID.AddComponent<AkGameObject>();
}
}
else
{
tempin_gameObjectID = unchecked((uint)-1);
}
in_pCookie = new AkCallbackManager.EventCallbackPackage(in_pfnCallback, in_pCookie);
{
uint ret = AkSoundEnginePINVOKE.CSharp_DynamicSequenceOpen__SWIG_1(tempin_gameObjectID, in_uFlags, (IntPtr)0, (IntPtr)in_pCookie.GetHashCode());
return ret;
}
}
示例4: Add
internal static void Add(UnityEngine.Object obj)
{
if (obj != null)
{
Add(obj.GetInstanceID());
}
}
示例5: GetAssetPreview
public static Texture2D GetAssetPreview(UnityEngine.Object asset)
{
if (asset != null)
{
return AssetPreview.GetAssetPreview(asset.GetInstanceID());
}
return null;
}
示例6: ShowAtPosition
internal static bool ShowAtPosition(UnityEngine.Object targetObj, Rect activatorRect, bool showLabelIcons)
{
int instanceId = targetObj.GetInstanceID();
bool flag = DateTime.Now.Ticks / 10000L < IconSelector.s_LastClosedTime + 50L;
if (instanceId == IconSelector.s_LastInstanceID && flag)
return false;
Event.current.Use();
IconSelector.s_LastInstanceID = instanceId;
if ((UnityEngine.Object) IconSelector.s_IconSelector == (UnityEngine.Object) null)
IconSelector.s_IconSelector = ScriptableObject.CreateInstance<IconSelector>();
IconSelector.s_IconSelector.Init(targetObj, activatorRect, showLabelIcons);
return true;
}
示例7: RemoveSavedFoldout
internal static void RemoveSavedFoldout(string uniqueID, UnityEngine.Object target, int index = 0)
{
string baseString = "Fold: " + target.GetInstanceID().ToString() + " - " + uniqueID;
string curString = baseString + index;
string nextString = baseString + ++index;
while (EditorPrefs.HasKey(nextString))
{
bool nextBool = EditorPrefs.GetBool(nextString);
EditorPrefs.SetBool(curString, nextBool);
nextString = baseString + ++index;
}
}
示例8: AddUnityReferenceValue
/** Serializes a Unity Reference. Serializer references such as Transform, GameObject, Texture or other unity objects */
public override void AddUnityReferenceValue(string key, UnityEngine.Object value)
{
//Segment --- Should be identical to a segment in AddUnityReferenceValue/AddValue
BinaryWriter stream = writerStream;
AddVariableAnchor (key);
if (value == null) {
stream.Write ((byte)0);//Magic number indicating a null reference
return;
}
//Magic number indicating that the data is written and not null
stream.Write ((byte)1);
//Segment --- End
if (value == active.gameObject) {
stream.Write (-128);//Magic number (random) indicates that the reference is the A* object
} else if (value == active.transform) {
stream.Write (-129);
} else {
stream.Write (value.GetInstanceID ());
}
stream.Write (value.name);
//Write scene path if the object is a Component or GameObject
Component component = value as Component;
GameObject go = value as GameObject;
if (component == null && go == null) {
stream.Write ("");
} else {
if (go == null) {
go = component.gameObject;
}
string path = go.name;
while (go.transform.parent != null) {
go = go.transform.parent.gameObject;
path = go.name+"/" +path;
}
stream.Write (path);
}
if (writeUnityReference_Editor != null) {
stream.Write (true);
writeUnityReference_Editor (this,value);
} else {
stream.Write (false);
}
}
示例9: LogSingleInstance
public static void LogSingleInstance(UnityEngine.Object instanceToLog, params object[] toLog)
{
int instanceId;
if (instanceDict.TryGetValue(instanceToLog.GetType(), out instanceId))
{
if (instanceId == instanceToLog.GetInstanceID())
Log(toLog);
}
else
{
instanceDict[instanceToLog.GetType()] = instanceToLog.GetInstanceID();
Log(toLog);
}
}
示例10: ShowAtPosition
internal static bool ShowAtPosition(UnityEngine.Object targetObj, Rect activatorRect, bool showLabelIcons)
{
int instanceID = targetObj.GetInstanceID();
long num = DateTime.Now.Ticks / 10000L;
bool flag = num < IconSelector.s_LastClosedTime + 50L;
if (instanceID != IconSelector.s_LastInstanceID || !flag)
{
Event.current.Use();
IconSelector.s_LastInstanceID = instanceID;
if (IconSelector.s_IconSelector == null)
{
IconSelector.s_IconSelector = ScriptableObject.CreateInstance<IconSelector>();
}
IconSelector.s_IconSelector.Init(targetObj, activatorRect, showLabelIcons);
return true;
}
return false;
}
示例11: DynamicSequenceOpen
public static uint DynamicSequenceOpen(UnityEngine.GameObject in_gameObjectID, uint in_uFlags, AkCallbackManager.EventCallback in_pfnCallback, object in_pCookie) {
uint tempin_gameObjectID;
if ( in_gameObjectID != null )
{
tempin_gameObjectID = (uint)in_gameObjectID.GetInstanceID();
// Note: if AkGameObjectTracker is already attached, the following code will be bypassed.
if (in_gameObjectID.GetComponent<AkGameObject>() == null)
{
in_gameObjectID.AddComponent<AkGameObject>();
// Note: We have missed AkGameObject.Awake() of this run to register.
// So we take over its work by inlining it here.
AkSoundEngine.RegisterGameObj(in_gameObjectID, in_gameObjectID.name);
//Set the original position
AkSoundEngine.SetObjectPosition(
in_gameObjectID,
in_gameObjectID.transform.position.x,
in_gameObjectID.transform.position.y,
in_gameObjectID.transform.position.z,
in_gameObjectID.transform.forward.x,
in_gameObjectID.transform.forward.y,
in_gameObjectID.transform.forward.z
);
}
}
else
{
tempin_gameObjectID = unchecked((uint)-1);
}
in_pCookie = new AkCallbackManager.EventCallbackPackage(in_pfnCallback, in_pCookie);
{
uint ret = AkSoundEnginePINVOKE.CSharp_DynamicSequenceOpen__SWIG_1(tempin_gameObjectID, in_uFlags, (IntPtr)0, (IntPtr)in_pCookie.GetHashCode());
return ret;
}
}
示例12: Cache
public void Cache (UnityEngine.Object obj, float life)
{
CacheObject cache = null;
assetDic.TryGetValue(obj.name, out cache);
if (cache == null)
{
cache = new CacheObject(life);
cache.id = obj.GetInstanceID();
cache.objName = obj.name;
cache.obj = obj;
cache.remainingLife = life;
cache.referCount = 1;
assetDic[cache.objName] = cache;
indexDic[cache.id] = cache;
}
else
{
cache.referCount++;
}
}
示例13: PostEvent
public static uint PostEvent(string in_pszEventName, UnityEngine.GameObject in_gameObjectID) {
uint tempin_gameObjectID;
if ( in_gameObjectID != null )
{
tempin_gameObjectID = (uint)in_gameObjectID.GetInstanceID();
// Note: if AkGameObjectTracker is already attached, the following code will be bypassed.
if (in_gameObjectID.GetComponent<AkGameObject>() == null)
{
in_gameObjectID.AddComponent<AkGameObject>();
// Note: We have missed AkGameObject.Awake() of this run to register.
// So we take over its work by inlining it here.
AkSoundEngine.RegisterGameObj(in_gameObjectID, in_gameObjectID.name);
//Set the original position
AkSoundEngine.SetObjectPosition(
in_gameObjectID,
in_gameObjectID.transform.position.x,
in_gameObjectID.transform.position.y,
in_gameObjectID.transform.position.z,
in_gameObjectID.transform.forward.x,
in_gameObjectID.transform.forward.y,
in_gameObjectID.transform.forward.z
);
}
}
else
{
tempin_gameObjectID = unchecked((uint)-1);
}
{
uint ret = AkSoundEnginePINVOKE.CSharp_PostEvent__SWIG_11(in_pszEventName, tempin_gameObjectID);
return ret;
}
}
示例14: ExecuteActionOnEvent
public static AKRESULT ExecuteActionOnEvent(uint in_eventID, AkActionOnEventType in_ActionType, UnityEngine.GameObject in_gameObjectID, int in_uTransitionDuration) {
uint tempin_gameObjectID;
if ( in_gameObjectID != null )
{
tempin_gameObjectID = (uint)in_gameObjectID.GetInstanceID();
// Note: if AkGameObjectTracker is already attached, the following code will be bypassed.
if (in_gameObjectID.GetComponent<AkGameObject>() == null)
{
in_gameObjectID.AddComponent<AkGameObject>();
// Note: We have missed AkGameObject.Awake() of this run to register.
// So we take over its work by inlining it here.
AkSoundEngine.RegisterGameObj(in_gameObjectID, in_gameObjectID.name);
//Set the original position
AkSoundEngine.SetObjectPosition(
in_gameObjectID,
in_gameObjectID.transform.position.x,
in_gameObjectID.transform.position.y,
in_gameObjectID.transform.position.z,
in_gameObjectID.transform.forward.x,
in_gameObjectID.transform.forward.y,
in_gameObjectID.transform.forward.z
);
}
}
else
{
tempin_gameObjectID = unchecked((uint)-1);
}
{
AKRESULT ret = (AKRESULT)AkSoundEnginePINVOKE.CSharp_ExecuteActionOnEvent__SWIG_2(in_eventID, (int)in_ActionType, tempin_gameObjectID, in_uTransitionDuration);
return ret;
}
}
示例15: AddUnityReferenceValue
//============== Custom Simpler Serializer
/** Serializes a Unity Reference. Serializer references such as Transform, GameObject, Texture or other unity objects */
public virtual void AddUnityReferenceValue(string key, UnityEngine.Object value)
{
//Segment --- Should be identical to a segment in AddUnityReferenceValue/AddValue
BinaryWriter stream = writerStream;
AddVariableAnchor (key);
if (value == null) {
stream.Write ((byte)0);//Magic number indicating a null reference
return;
}
//Magic number indicating that the data is written and not null
stream.Write ((byte)1);
//Segment --- End
if (value == active.gameObject) {
stream.Write (-128);//Magic number (random) indicates that the reference is the A* object
} else if (value == active.transform) {
stream.Write (-129);
} else {
stream.Write (value.GetInstanceID ());
}
stream.Write (value.name);
//Write scene path if the object is a Component or GameObject
Component component = value as Component;
GameObject go = value as GameObject;
if (component == null && go == null) {
stream.Write ("");
} else {
if (component != null && go == null) {
go = component.gameObject;
}
UnityReferenceHelper helper = go.GetComponent<UnityReferenceHelper>();
if (helper == null) {
Debug.Log ("Adding UnityReferenceHelper to Unity Reference '"+value.name+"'");
helper = go.AddComponent<UnityReferenceHelper>();
}
//Make sure it has a unique GUID
helper.Reset ();
stream.Write (helper.GetGUID ());
/*if (go == null) {
go = component.gameObject;
}
string path = go.name;
while (go.transform.parent != null) {
go = go.transform.parent.gameObject;
path = go.name+"/" +path;
}
stream.Write (path);*/
}
/*if (writeUnityReference_Editor != null) {
stream.Write (true);
writeUnityReference_Editor (this,value);
} else {*/
//Backwards compability
stream.Write (false);
//}
}