0

Beginner Here! Help With Variables

Soracle Media 8 months ago updated 8 months ago 6

I need to use various bits of information together to create a final number. However I will then want to use that number elsewhere. I feel that I will need to create a flow machine for the "algorithm" for the first number but then I get a little more confused. What type of variable (or other function) should I use to "save" it and then use it elsewhere? 

For Example: Lets say I have a business. The first "variable" I want to create is the "Product Cost". This would involve brining in values for labour, materials etc and then coming to the final number. Then in another section we may want to use the "Product Cost" with a "Product Retail Price" variable to create a "Profit". All of those numbers would need to be fluid to react to any changes...


Any help would be much appreciated!

Bolt Version:
1.4.10
Unity Version:
2019.2.18f1 Personal
Platform(s):
iOS
Scripting Backend:
.NET Version (API Compatibility Level):
+1

scene variable can be modified by all flow mashines in scene/  

or  object variable but you will need find objects in scene /Get child or Get Parent  or Find Object etc to use their variable

u can use both but for final number probably scene var is good/   

Thank you very much. I will try that. I was considering object variable but then wasn't sure if I used them with one object for example a coffee farmers "profits" whether I could then use it for the coffee shop's "costs"... Does that make sense? 

+1

you can do it with  object variable / drug and drop  object and get its variable-change and save/

( drug and drop works with embed  flow mashine but for macros you will need find objects by name or somehow else by tag or layer)  find with name is not good as i know cos unity need check strings of all objects in scene. at start maybe it dosnt matter but if during gameplay it can be drop in performance(i didnt test this)

maybe somebody has tips too

Ok I can certainly test with that thanks. One final thing for now, what is the easiest way to display a variables value? That way I can check if what I want it to say is actually working.

+1

you need UI to display/ but you can check it in inspector . there will be change in that obj variable/


scene variables are in scene variables obj

+1

Thank you so much. I have more questions but I will make sure they go in their own thread so others can find it. The support here is great. I promise I will pay it back when I have the knowledge!