lundi 18 février 2019

Instantiating at random based on word

I have a word = "CAT" I have 26 alphabet prefabs A - Z - prefab array I want to instantiate 6 prefabs from the prefab at random so B,L,T,C,A,T - in any random order but I need it to include the letters that makeup the word cat

My first thought was to use a dictionary/hashmap to map the word cat to the position in the array i.e C = [2] A = [0] T[] but the hashmap/dictionary only takes a key value pair but I am providing it with more than one value the 3 letters needed

This is being programmed in unity so my prefabs are already in the letters array its just getting them to include my spelling.




Aucun commentaire:

Enregistrer un commentaire