#singleton

1 messages · Page 1 of 1 (latest)

mighty zinc
#

Yes, create a singleton of that script

hushed sandal
#

Singleton?

mighty zinc
#

Yeah, so at the top, put public static myScriptName instance

vague atlas
#

Is the reason you're making a singleton for "easy referencing" ?

hushed sandal
#

What does singleton means tho

mighty zinc
#

He could access the variables from myScriptName.Instance from any script

#

So yeah

merry forum
sly flax
#

You can use a scriptable object . . .

hushed sandal
#

Never heard about scriptable object

#

Sounds interesting tho

vague atlas
#

the one of the only good brackeys tutorials is on Scriptable Objects

#

I'd recommend watching it

hushed sandal
#

Oh k

#

Also i want to know about singleton tok

#

Too*

vague atlas
#

SO is perfect for what you want. they are essentially data containers

sly flax
#

It's the only way to avoid placing a script on a game object . . . unless you create a script to put on a game object, turn it into a prefab, and reference the prefab in a variable from a script on a scene object, but that's a workaround . . .

hushed sandal
#

Actually i want smth like

#

Creating a script
Writing down some variables

#

And then accesing them anytime and everywhere i want

#

Like a global variables

vague atlas
#

Scriptable Object

hushed sandal
#

Kk

#

Oh also

#

Another question

#

Can i get classes and methods from scriptable object?

vague atlas
#

methods yes, i am unsure abour classes

hushed sandal
#

I had another question but i forgot it

#

Well nvm, ty for answering me

#

I REMEMBER

#

How do i get items from assets folder

vague atlas
#

Example?

hushed sandal
#

Well for example i have material inside assets

#

Oh..