Hello,
I have 2 components and I want both of them to show the same property (different instances of course).
How do I manage to do this in TypeScript?
I tried to use extend but I can extend only from one class…
Hello,
I have 2 components and I want both of them to show the same property (different instances of course).
How do I manage to do this in TypeScript?
I tried to use extend but I can extend only from one class…
not sure if this fits your goals, but you could, assuming your components are C1 and C2, create a new component C3, extract the shared property to component C3 then make C3 requireComponent C1 and C2 and/or C1 and C2 requireComponent C3.
then in C1 and C2, you would getComponent(C3) and access the property.
Looks interesting,
Found the decorator you mentiond.
I will try it. Thank you…
For reference check this link
https://docs.cocos2d-x.org/creator/manual/en/scripting/access-node-component.html