I have X number of instances that can come in 2 forms in an array of instances and as descendants of an instance. I want to detect changes to their properties on runtime in an efficient way. I would ideally like behavior like this fake example: "Instance.DescendantChanged:Connect(...)" (This example can't be applied to the array). I would like to avoid running a check on all the instances on every frame.
Due to memory concerns, I would also like to avoid connecting events on all the instances.
Keeping track of objects that are prone to changes and only checking them is also not an option
#Detecting property changes on a large number of instances efficiently
1 messages · Page 1 of 1 (latest)
local function onChanged(property)
print(property)
end
for index, instance in instances do
instance.Changed:Connect(onChanged)
end
or
for index, instance in instances do
instance.Changed:Connect(function(property)
print(instance.Name, property. instance[property])
end)
end
"Due to memory concerns, I would also like to avoid connecting events on all the instances."
This would take up mememory for every instance
Unlike a singular event based system
if collectionservice had a .Changed event this would make my life so easy
please, correct me if my memory concerns are unfounded
only other way is to force the thing changing the property to use a function in a module
local modules = {}
function module.SetProperty(instance, index, value)
instance[index] = value
print("Changed")
end
return module
then who ever sets the property does
module.SetProperty(Part, Position, Vector3.new())
I cannot impose the use of the setter function
then the next best thing is #1219701168192753786 message
3gb I’d say
3gb is a strange amount of ram to have because most who build a PC would want dual channel setup and you can't have 3gb with dual channel because you can't buy 2 1.5gb sticks
I thought you meant the Roblox client
Since the context is around that
Yes the clients computer will most likely be built to support dual channel
To have 3gb you would need to do 1 + 1 + 1 GB or 2 + 1 GB and both of these configurations are silly