playMaker

Author Topic: create prefab called [string] from array?[SOLVED]  (Read 2353 times)

westingtyler

  • Sr. Member
  • ****
  • Posts: 277
    • My Video Game Projects Web Site
create prefab called [string] from array?[SOLVED]
« on: October 13, 2016, 09:02:07 AM »
Basically, you click an icon of a chair. that icon game object is called "oak chair."

I want to create a prefab of "oak chair" when I click that icon. I just want to save the icon name string, then create a prefab from a list of prefabs, that is also named what the string is named.

Also, there are like 100 different chairs to do this with.

Can I do this with a 1.8.3 array, or should I use arraymaker, or some other method? I am really stumped. I really don't want to have to make a string switch with 100 options in it.
« Last Edit: July 27, 2020, 01:11:54 AM by jeanfabre »

terri

  • Sr. Member
  • ****
  • Posts: 386
    • terrivellmann.tumblr.com
Re: create prefab from array based on string?
« Reply #1 on: October 13, 2016, 09:08:14 AM »
with arraymaker you can have a hashtable where the key is the icon's name string and the value is the corresponding prefab

westingtyler

  • Sr. Member
  • ****
  • Posts: 277
    • My Video Game Projects Web Site
Re: create prefab called [string] from array?
« Reply #2 on: October 13, 2016, 09:47:18 AM »
thanks. it works, and here is a picture of the action I used.

ps. does this need to be an "action sequence"? I am afraid it may try to do the second action first if I don't specify they should go in order?