Hello,
I am trying to retrieve object prefab name. I know that I can do that using:
PrefabUtility.GetPrefabParent(gameObject).name
but the problem is that it only works inside editor. I’m working on the ‘SelectionManager’ in my game and right now I want to make double click on an object and select multiple same objects method, but I first want to somehow tag all the objects so that when I double click on a curtain object it would only select objects with the same type / tag. I thought about making an enum, but getting a name is much more simple and convenient.
Are there any ways in getting the prefab name outside the editor? Also maybe it’s possible to somehow get the original gameObject name without counter tag?
Or are there any better way’s in making something like this? Thank you
If you have a GameObject variable and fill it with a reference to the prefab, you should be able to access it to get the name. Either as a public variable that can be assigned in the Editor before playing or at runtime via Resources.Load.
– ChernoThats fine, call it whenever you score then. it doesnt have to be in the update
– Llama_w_2Ls