GameObject instance = Instantiate(Resources.Load(“kubik”), new Vector3(0, 1, 0), Quaternion.identity);
Code tags
What error are you getting?
What are you expecting to happen?
Proper grammar
You’ve made just about every error you can make posting a question here. I’d love to help, but you got to give me something to go on.
error CS0266: Cannot implicitly convert type UnityEngine.Object' to
UnityEngine.GameObject’. An explicit conversion exists (are you missing a cast?)
I DID!!!
What he means is it might be nice if you posted the full code involved and write a bit more coherently so that we actually understand what you’re trying to do.
as GameObject
GameObject instance = (GameObject)Instantiate(Resources.Load<GameObject>("kubik"), Vector3.up, Quaternion.identity);
You can skip the cast completely now as Instantiate has a generic overload. See the last example here: Unity - Scripting API: Object.Instantiate
1 Like
Good catch. Thanks!