Potrzebuję utworzyć instancję i zniszczyć prefabrykat w biegu. Próbowałem:Wywoływanie i niszczenie Unity3D
public Transform prefab; //I attached a prefab in Unity Editor
Object o = Instantiate(prefab);
//using this I cannot get the transform component (I don't know why) so useless
Transform o=(Transform)Instantiate(prefab);
//gives transform and transform component cannot be destroyed
GameObject o=(GameObject)Instantiate(prefab);
//invalid cast
Jak to zrobić?
Trzeba studiować jakiś OO koncepcji. Chodzi o zmienną TYPE. – Chchwy