Unity 4 with new function for setting parent of GameObject?

Hi there,

when I first started coding at my current project, I used something like gameObject.transform.parent = bla to set the parent of a GameObject.

Now, I recently needed to set a GameObject’s parent again and discovered the method SetParent() of gameObject.

_currentGO.SetParent(_dynamicObjects);

When my mates updated their code (they use early Unity 4 version, me the latest), they were told that this method does not exist.
I couldn’t find the changelogs for the Unity Updates.

Am I right with my assumption, that this function is quite new?

it seems that the parent transform position is not set with a function SetParent anymore but like any other transform: Gamobject.parent = transform; http://docs.unity3d.com/Documentation/ScriptReference/Transform-parent.html

1 Answer

1

There is no such method in the Unity API as of now. Are you sure you don’t have anything in your codebase that extend GameObject class and adds it that method? You can figure it out by doing a solution search with CTRL Shift F.

doh! ... there was a plugin who did some modifications to GameObject... a beginner's mistake