About referencing Story Text gameobject to another game object

We are referencing Story Text game object to another Game object then adding script to Game object for adding text programmatically. Can we not directly perform the same task with Story Text object only?

For clarity, I want to add a string in the text field of Story Text.text component from a script while the game is in play without using any extra object.

Hi,

Does your solution work? If so, keep it. In many cases, there are multiple ways to make something work in Unity, and Rick cannot show all of them.

We are following the single responsibility principle, though, which is one of the most important principles in object-oriented programming (OOP). This means we often create more objects and methods to get distinguishable, simple tasks, and do not put everything in one class or method though we could.

Did this clear it up for you?


See also:

Well I haven’t checked the one object way of doing the same yet.
I will notify to you after I try what I said

How are you getting on with this, @ab_dev?

This topic was automatically closed after 3 hours. New replies are no longer allowed.

Privacy & Terms