Store strings with gameobjects

Hello
i came often into situations where i would like to store something in the gameobject rather than in the code.
Usually its a string as example i want to store the name of the object this was instantiated from in the gameobject.

is it possible, how to do this?

Not sure if this is what you’re looking for, but do you know about Scriptable Objects?

I dont know about it i took a short look at it but i did not watch the full video is it essentially attaching a script to the object which does store the data? it does look cumbersome.

Make a MonoBehaviour class with the string, and add it to the GameObject as a component. Unity uses a component-based architecture.

–Eric

2 Likes

Thankyou