Alienhead Posted April 20, 2022 Share Posted April 20, 2022 I'm looking for verification that this is normal behavior and if so what steps are needed to get around it. In code I'm loading several entitys(mdl) at a give time. Like so : local ef =Model:Load("Materials/Particles/planeeffect/explo1/explo1.mdl") ef:SetScript("Materials/Particles/planeeffect/explo1/explo1.lua", true) ef:SetPosition(self.entity:GetPosition()) I understand theres more efficient way to do this but this is how I've broke it down for this example. So I'm not using Instance or Copy as you can see, why is the same surface shared between 4 distinct entitys loaded separately using no instancing or copying. In the pic I have colored each of the entitys a different color to show my claim. Each call to SetColor would change all 6 objects. Is this the nature of the engine or is there a hidden step I need to take to have separate surfaces on these models since. Does AddRef() count come into play here? or is that just to prevent models from being deleted. Quote I'm only happy when I'm coding, I'm only coding when I'm happy. Link to comment Share on other sites More sharing options...
Josh Posted April 20, 2022 Share Posted April 20, 2022 When you load a resource, the engine checks if it is already loaded and creates an instances if it already is. So you are seeing normal behavior. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Alienhead Posted April 20, 2022 Author Share Posted April 20, 2022 Okay good to know, now If I wanted to cheat and have two seperate entity of this same kind - what is the engine pulling out of the cache? the surface or the mat ? or would I need to load a different named mat or differently named mesh ? or both ? Quote I'm only happy when I'm coding, I'm only coding when I'm happy. Link to comment Share on other sites More sharing options...
Josh Posted April 21, 2022 Share Posted April 21, 2022 Add Asset::Unmanaged to the load flags to load a unique new copy of the item. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.