All game objects that exist in the world are counted agaist that limit and it does not matter if they are placed by hand in the editor or spawned in runtime through a script. The project setting max_instances in Collection related settings limits the total number of game object instances that can exist in a world (the llection loaded at startup or any world loaded via a collection proxy). go_id ) - Calling unload will decref resources held by the factory component, - resulting in resources being destroyed.
In this case resources aren’t deleted since the factory component - still holds a reference. load ( "#factory", load_complete ) end function final ( self ) - Delete game object. create ( url ) end function init ( self ) - No factory resources are loaded when the factory’s parent - collection is loaded.
You can also provide a vector3 where each component specifies scaling along the corresponding axis.įunction load_complete ( self, url, result ) - Loading is complete, resources are ready to spawn self. The scale can be expressed as a number (greater than 0) which specifies uniform scaling along all axes. (optional) The scale of the spawned game object. See the Script property manual for information on script properties. (optional) A Lua table with any script property values to initiate the game object with. (optional) The world rotation of the new game object. If you do not specify a position, the game object is spawned at the position of the factory component. (optional) The world position of the new game object. create ( component, p )įactory.create() takes 5 parameters: url The id of the factory component that should spawn a new game object. lerp ( math.random (), min_y, max_y ) local component = "#star_factory" factory.