How many copies of WayPoints are stored?

I was wondering how many copies of a Waypoints are stored in this program and could it be a potential problem? There is the original set of waypoints created in the editor, the FindObjectsOfType returns an array of these WayPoints, and then they are stored again in the dictionary. If a copy is taken each time we would be storing 3 copies of the WayPoint instance. While this is probably not a problem for this training program if we use the method for large objects and/or if there are large numbers of them could this become a concern? Particularly if you were creating a game for a mobile device where memory might be more restricted than on a PC. Of course, if references are being passed rather than copies of the program it might be less of an issue. Any thoughts/comments?

GameObject is a Class and as such a reference type, so you’re not actually creating any copies at any point outside the editor without some kind of explicit creation method.

This might clarify: https://docs.microsoft.com/en-us/dotnet/visual-basic/programming-guide/language-features/data-types/value-types-and-reference-types

Privacy & Terms