how can i add null to this script to see if a object has been destroyed?
public static void Stop(GameObject target, string type)
{ Component[] tweens = target.GetComponents(typeof(iTween));
foreach (iTween item in tweens){ string targetType = item.type+item.method;
targetType=targetType.Substring(0,type.Length);
if(targetType.ToLower() == type.ToLower()){ item.Dispose(); } } }
1 Answer
1
sdgd
2
BTW your code was very bad written so I had to re edit it to even see what’s going on
next time I’ll leave the down vote
I removed it as you did help me help your self
public static void Stop(GameObject target, string type){
if (target == null){
return;
}
Component[] tweens = target.GetComponents(typeof(iTween));
foreach (iTween item in tweens){
string targetType = item.type+item.method;
targetType=targetType.Substring(0,type.Length);
if(targetType.ToLower() == type.ToLower()){
item.Dispose();
}
}
}
all you need to enter is
after the start of your function
if (target == null){
return;
}
else you would wrap whole your inside of function in to:
if (target != null){
// your code you need
}
oiiiii format your code please you have 1010101 on the top
– sdgd