Home c# in Unity when using SetParent () The object changes its form to...

in Unity when using SetParent () The object changes its form to the parent




When the beam falls into the object, this object should become a subsidiary of another object, but it disappears (we assume that it changes the form for the parent, since the parent object is an empty object).

Answer 1, Authority 100%

SetParent (Transform) has a SetParent (Transform Parent, Bool WorldStays) overload. Use overload to eliminate your problems.

WorldPositionStays If True, The Parent-Relative Position, Scale and Rotation Are Modified Souch That The Object Keeps The Same World Space Position, Rotation and Scale as Before.

If your future parent object Ctrl_element is turned off, then all the child objects will be turned off, because it is enabled that it is turned on at the moment of changing the parent object HIT.Transform.SetParent (Ctrl_element.transform, TRUE);

You should also check if there is an effect on ctrl_element from other sources, it may turn off or moves to click, and maybe it is removed?

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions