Quantcast
Channel: Answers by "dubbreak"
Viewing all articles
Browse latest Browse all 68

Answer by dubbreak

$
0
0
Because the Transforms are by reference not by value. When a new scene loads they all end up null (assuming the Transforms are of scene objects). If you want to keep them around you either need to make copies of the Transforms to put in your list (which not change when the original transform changes) or use Vector3 or some other datatype to store them statically (updating periodically). If you are familiar with pointers (and not with references), it's essentially your list is a list of pointers to Transforms (that are owned by the object). When that object goes away that memory location is now null (because of the object destructor). Not 100% correct, since it's references, not pointers.. but the key point is you don't have copies of the Transforms, your list just points to the existing ones and when the object with that transform goes away the transform gets nulled.

Viewing all articles
Browse latest Browse all 68

Latest Images

Trending Articles





Latest Images