5
votes
Parameter "current->parent" is null, don't see why
Found it, thanks to @Mangata. It is a weird bug.
My help boxes had default text using [dropcaps] on a single letter, terminated immediately afterward; but the terminator seemed to fail to register ...
5
votes
Looping through children in a foreach loop
By itself, the transform class implements the IEnumerable (with Transform as the generic type) interface, which allows you to use a foreach with a transform as the interable object. You could also use ...
4
votes
Accepted
Efficiently calculate 2d world position based on parent(s) recursively
The way this is typically handled is with a dirty flag.
Each object stores both its current local transformation/bounds, and a net transformation/bounds according to its whole parent hierarchy (eg. a ...
4
votes
Accepted
What does the Node2D transform property do?
In games, a "transform" refers to how an object is positioned, oriented, or scaled within the game world.
To move an object, to rotate an object, or to squash and stretch an object are all forms of "...
3
votes
Accepted
Object scales strangely when setting y rotation after parenting
When you nest objects in the Hierarchy, all the transformations applied to the parent get applied to its children.
That means that if a parent has a non-uniform scale applied, its child objects will ...
3
votes
Accepted
Is it more efficient to add scripts to each GameObject or to a single parent object?
There is some amount of overhead to invoking each script's Update() and other methods, compared to maintaining a list of objects and updating them all at once from ...
3
votes
Accepted
Add picture in the Hierarchy view in Unity
They are hooking into the EditorApplication.hierarchyWindowItemOnGUI event. In their case they are storing a single icon texture within their editor script, and ...
2
votes
LIBGDX - group as child of an actor?
We don't know which things are containers and what they can contain.
But let's assume your world work this way:
Empires can contains Kingdoms, but also Cities (which are not contained by any Kingdom ...
2
votes
Accepted
Unity, Detect the last GameObject in the hierarchy of a given list of GameObjects
Here is a script I've made to determine which Transform is the "front most" according to the hierarchy. But be careful, if one of the "candidates" has a higher z ...
2
votes
Accepted
When/Where to use Node2d as parent vs Other Node
tl;dr: Use the generic Node2D, Node3D, Control or Node ...
2
votes
Accepted
How to access specific child indices (directly, not using tags or searches)?
Accessing by index is a little fragile, if the structure of your prefab were ever to change.
As your object is a prefab, you might consider adding fields to your ...
2
votes
Difference between methods - onClick.AddListener and On Click under UI button inspector?
In this particular context there is no good reason to use one over the other.
But in general, there are a couple things you might want to consider:
Assigning buttons in the inspector requires no ...
2
votes
Accepted
matrices and nesting hierarchy with game objects
Inheritance of transformation is the main reason we like to use transformation hierarchies in game scenes.
If I want to move a car, it's convenient that I can simply move the body/root of the car, ...
2
votes
Accepted
Last hole artifact in screen space refection with Hierarchical Z
After some refinements I have found the solution (see picture). The vertical holes were due to the line "return ColorOut" just after the refinemax loop. This line must be removed to let the ...
1
vote
Accepted
Is there a way to filter/search only the children of a selected gameobject in the hierarchy panel?
Try adding this to your search:
path:parentObjName/
There's a cheatsheet with heaps of helpful filters.
1
vote
When/Where to use Node2d as parent vs Other Node
In general, there's not necessarily a right answer for selecting one over the other in Godot. There's probably a measurable typically negligible performance impact to adding an extra layer of ...
1
vote
Best practice for getting references to specific child objects in Unity
In addition to the methods in the answer by DMGregory I would like to offer a 4th alternative: GetComponentInChildren<SomeDistinctComponent>().
In most cases, ...
1
vote
Best practice for getting references to specific child objects in Unity
There aren't any testable rules about which object should be referenced
If you can't state a rule for the computer to follow, then there's no way to automate this. You will have to manually specify ...
1
vote
Accepted
Parent object does not rotate on its own axis with its children. How do I fix it?
When I gave a gizmo to my parent object, I saw that the gizmo wasn't in the center of my parent object. So the character is turning, but instead of rotating on its own axis, it rotates around the ...
1
vote
Accepted
Trying to access existing animator SetTrigger does nothing and returns error
As I wrote in the comment, you are loading twice the same animator. While you do assign the correct ones in the inspector, in the code you are reloading the animators in the start method. Therefore in ...
1
vote
Accepted
How can I apply UV mapping in parent space?
I think you're right that the only way to get this is to pass a custom variable each frame:
...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
hierarchy × 31unity × 15
c# × 9
transformation × 8
gameobject × 7
animation × 3
rotation × 3
godot × 3
scale × 3
java × 2
scene-graph × 2
animator × 2
c++ × 1
2d × 1
libgdx × 1
shaders × 1
javascript × 1
directx11 × 1
tilemap × 1
path-finding × 1
software-engineering × 1
matrix × 1
quaternion × 1
coordinates × 1
rigidbody × 1