Hi,
I would like to get parameters on prefab that isn’t instantiate.
For example, the prefab A, have a script “Script”, with the value “Hello”.
How to get the value Hello without instantiate the prefab ?
Thank you
Hi,
I would like to get parameters on prefab that isn’t instantiate.
For example, the prefab A, have a script “Script”, with the value “Hello”.
How to get the value Hello without instantiate the prefab ?
Thank you
You can reference the prefab just like a scene object. Have a public variable, assign the prefab to it and use getComponent().
Yes, but I don’t want a list of 100 prefab for that, hm…
The only solution is to instantiate and keep the item hiden. But I really don’t like that
You can also search for it with Resources.Load if you don’t want to have a huge list of prefabs in the inspector. You’d then only load the one(s) that you currently need, but that’s also a bit slower.