1
\$\begingroup\$

I'm trying to instantiate an object using Object.Instantiate() like this:

Instantiate(carrot, transform, true);

according to the below snippet from the documentation, this is what I should be allowed to do.

screenshotted from Unity Instantiate docs

However, when I try to highlight this in my code, it instead shows me this:

screenshotted from visual studio

As far as I can tell (though I am very limited in my knowledge of this stuff) this shouldn't be possible. Do I have any other way to show which version I want to use? I need to use this specific version because I want the instantiated object to inherit the scale of the object that's instantiating it. I've used this solution before when instantiating objects, I don't know what's changed.

\$\endgroup\$
2
  • \$\begingroup\$ Whats the type of carrot? If it is a Gameobject, you should see the same as from the documentation. The other one is if it is from the Object (Base class for all objects Unity can reference) \$\endgroup\$
    – Zibelas
    Commented Mar 25, 2022 at 20:09
  • \$\begingroup\$ the carrot is just a GameObject \$\endgroup\$
    – Max Bailey
    Commented Mar 25, 2022 at 21:18

1 Answer 1

1
\$\begingroup\$

These are just two ways of naming the same thing. All they did was change the name of the parameter, but the interpretation is the same:

pass true to position the new object directly in world space. Pass false to set the Object’s position relative to its new parent.

So, you don't have to do anything to select a different overload. This is the only one that exists. If this overload is not giving you the behaviour you want, post about that issue, and we can help you write alternative code that does give the behaviour you want.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .