Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

how do I make an Instantiate function with 4 parameters

I am trying to make an Insatiate Function but it isn’t really working it is suppose to make an platformer spawn but there is an error saying: Cannot Convert From ‘(int, int, int)’ to ‘Transform’

for (int i = 0; i < objectCount; i++)
        {
            Instantiate(prefab2, position, Quaternion.identity, (0, -Height, 0));
            position.x += spacing;
    }

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

If you take a look here: https://docs.unity3d.com/ScriptReference/Object.Instantiate.html
at the Declaration it says:

public static Object Instantiate(Object original, Vector3 position, Quaternion rotation, Transform parent);

The fourth argument you have is (0, -Height, 0) which is (int, int, int).
But it wants a Transform. (The Transform of the Parent it should have)

I dont know what you want with (0, -Height, 0), maybe you could clear up?

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading