Quantcast
Channel: Answers for "Determine if an external prefab exists within the project 's assets folder (not in scene)"
Viewing all articles
Browse latest Browse all 4

Answer by Chris Masterton

$
0
0

If you know the name of the prefab you could try GameObject.Find. A return value of null would mean it is not loaded.

GameObject myPrefab = GameObject.Find("nameOfMyPrefab");
if( myPrefab == null )
{
  // Uh oh, my prefab has not loaded.
}
else
{
  // We found the prefab, therefore it loaded.
  // You may still have to check if its activated -
  //   I'm a bit unsure on this part!
}

Please post your results!


Viewing all articles
Browse latest Browse all 4

Latest Images

Trending Articles





Latest Images