(DEC 19 2015)
The answer is simply using the name of the sprite to do the check, and then also check if the boolean is true.
I wanted it to be a bit less code, but its not taking up that many lines of code, so its fine.
Answer:
if(tempstr == "Nameofimage" && Nameofimage == true) //Be Happy
(DEC 17 2015)
Thank you very kindly
I am pretty sure that this doesn’t happen often.
This solution would be perfect (Everything works great) if I already knew ahead of time what boolean I’d replace myBool with. However, I am doing something a little bit more strange.
I`ll try to explain this the best I can
Inside my assets folder, I have the sprites, which are named:
%|-781188308_1|%
%|-284706502_1|%
%|-90134012_3|%
%|1940178792_2|%
I also have 50+ booleans named after their corresponding sprites names`.
ImageType0 = true;
ImageType1 = false;
ImageType2 = true;
ImageType3 = false;
The sprites are images, that can be viewed if they`ve been unlocked.
If the image is not locked, then its corresponding boolean is true. (meaning its been unlocked)
Now when I set it up to select a random sprite, It needs to be able to check if its been unlocked or not yet, so I tried this:
stringBool = System.Convert.ToString(GameController.Temp_Sprite.name);
if(stringBool== "True") {
print("True");
}
else {
print("False");
}
I came to the conclusion that its always going to be false, since the stringBool is just the name of sprite.
How can i get the value of ImageType0 (the bool), simply by using the image’s name that is randomly selected
Thank you for you help with this @Knnthra.
As you can see, its not entirely trivial…
Cheers.
DLively