waw Posted August 29, 2017 Share Posted August 29, 2017 (edited) This way ? AddPrefabPostInit("existingprefab", function(inst) if inst.components.existingcomponent then local Old_ExistingFunction = inst.components.existingcomponent.ExistingFunction function inst.components.existingcomponent:ExistingFunction(...) print("Overridden !") return Old_ExistingFunction(self, ...) end end end) or this one ? local ExistingComponent = GLOBAL.require("components/existingcomponent") local Old_ExistingFunction = ExistingComponent.ExistingFunction function ExistingComponent:ExistingFunction(...) if self.inst.prefab == "existingprefab" then print("Overridden !") end return Old_ExistingFunction(self, ...) end Edited August 29, 2017 by waw typo Link to comment Share on other sites More sharing options...
ZupaleX Posted August 29, 2017 Share Posted August 29, 2017 The first one. There is no need to override the complete component if you want it to affect only one prefab. Link to comment Share on other sites More sharing options...
Parusoid Posted August 30, 2017 Share Posted August 30, 2017 Can I tune ACTIONS the same way? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now