Hi everybody,
I want to know if it’s possible to find the prefab location of a Instantiate mesh in my scene.
I know it’s possible to instantiate a prefab in that scene but I want to do the inverse.
I got my mesh/prefab instantiate and I want to know where is the object use to instantiate in my Project hierachy.
Not sure what you’re trying to do or I could help better. My guess is you want to run a check to see what an object is. I don’t know of any code for that, but you could add a public variable to the objects you want to check and look at that to determine it. For example:
// For a vegetable
public var objecttype = 1;
// For a mineral
public var objecttype = 2;
// check what the object is
if (gameObject.objecttype == 1) {
// Spawn a new vegetable
Instantiate(vegetable);
}
else if (gameObject.objecttype == 2) {
// Spawn a new mineral
Instantiate(mineral);
}
I think I explain it wrong :/.
So i’ve got a script which instantiate an object. And at runtime, if I’ve got a mesh, I want to know where is the prefab which allow me to create this mesh.
I want to know where is its location in the project (path or something) just with the name or the reference of the instantiate object.