playMaker

Author Topic: Accesing at runtime multiple objects component  (Read 684 times)

emildragan

  • Playmaker Newbie
  • *
  • Posts: 28
Accesing at runtime multiple objects component
« on: November 04, 2020, 11:40:06 AM »
Hello, I am struggling with this problem and can t find the proper way of doing this.

I have let s say a calendar, with 365 days. What I need is that during runtime, the player chooses a word, by typing in an input field and then that word will appear in the selected date, like an event in ordinary phone calendar.
What I tried is to have get property action (textmeshpro ui) on every dates, save into the same string variable and then by pressing a single button, to change that variable to that word. What I understand is that you cannot use multiple values for a single variable, in my case, a string.
I also tried to put all the objects that contains text mesh pro component in an arraylist at runtime and then to access their component and to change the text, bu t I don t see how it s possible to access at runtime multiple objects components.

I managed to save all the objects form an arraylist into a gameobject variable, get the text component and then use the "set string value" action, but it works only for one gameobject, not for all. Also, there is an action called "send event by tag". If all my 365 objects have the same tag and I want to send the same event to all of them, what event should I use in order to change the text field for all of them?
I don t know if it s clear, but the question is how can I access and edit at runtime the text component of multiple objects?

I appreciate any answer or guidance.

Thank you.

wetcircuit

  • Full Member
  • ***
  • Posts: 158
    • wetcircuit.com
Re: Accesing at runtime multiple objects component
« Reply #1 on: November 04, 2020, 01:42:40 PM »
information can 'push' from a central manager to all the instances…

or, you could make the instances 'pull' by having them grab variables off the central repository.

emildragan

  • Playmaker Newbie
  • *
  • Posts: 28
Re: Accesing at runtime multiple objects component
« Reply #2 on: November 06, 2020, 07:09:59 AM »
Thanks, I ll see what I can do.