BakaSchwarz Posted March 8, 2018 Share Posted March 8, 2018 I searched but did not find anything regarding this matter. If i have the prefab string, how can i get the name of the entity? I know i can use inst.name when i spawn it, but is there a way to avoid spawning it? Link to comment https://forums.kleientertainment.com/forums/topic/88457-prefab-to-full-name/ Share on other sites More sharing options...
pickleplayer Posted March 8, 2018 Share Posted March 8, 2018 are you maybe looking for inst.prefab? Link to comment https://forums.kleientertainment.com/forums/topic/88457-prefab-to-full-name/#findComment-1012698 Share on other sites More sharing options...
BakaSchwarz Posted March 8, 2018 Author Share Posted March 8, 2018 (edited) inst.prefab is only usable when i have an instance of the prefab. It's also not what i need since it gives me the prefab name, but not the full name. As an example: I have the prefab "eyebrellahat". What i want is a way to translate this to "Eyebrella" without spawning the prefab and calling inst.name What i am currently doing is something like this and it just feels bad in a performance way: local prefab_spawncode = "eyebrellahat" local inst = SpawnPrefab(prefab_spawncode) local prefab_name = inst.name -- This returns "Eyebrella" inst:Remove() Edited March 8, 2018 by BakaSchwarz Link to comment https://forums.kleientertainment.com/forums/topic/88457-prefab-to-full-name/#findComment-1012704 Share on other sites More sharing options...
pickleplayer Posted March 9, 2018 Share Posted March 9, 2018 Ohhhh, I see what you mean. I don't know of any ways to do that, sorry. Though I'm curious as to why you would need to do it that way, and what you're trying to do in the first place. There may be a different way to do it Link to comment https://forums.kleientertainment.com/forums/topic/88457-prefab-to-full-name/#findComment-1012709 Share on other sites More sharing options...
IronHunter Posted March 9, 2018 Share Posted March 9, 2018 (edited) It almost seems like your trying to get the STRINGS.NAMES[spawncode] for the prefab right? If that is what you are trying to do, I found this blurb from entityscript. --line 646 in function EntityScript:SetPrefabName(name) STRINGS.NAMES[string.upper(self.prefab)] Replacing self.prefab with a string like "eyebrellahat" gives me the string name that you get when you hover over stuff. Hope that helps Cheers, Iron_Hunter Edited March 9, 2018 by IronHunter typographical errors Link to comment https://forums.kleientertainment.com/forums/topic/88457-prefab-to-full-name/#findComment-1012722 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now