Hey there guys, in a bind…
I have created my own saving/loading system, which works exactly as I’d like.
But there’s one last piece to the puzzle I’m stumped with.
I can save the component values, but it hadn’t hit me yet but I realized as soon as I started making the “Loading” script that I couldn’t do Component c = <TypeFoundInLoad>().SomeVariable
.
I can FIND the type during load, I just don’t know how to access the variable, because Component isn’t exactly Health h = GetComponent<Health>().health = 100
. (Hence I need to figure out how to get the part at the end ().health = “ValueFoundInLoad”.)
So here’s the break down of what I am doing.
I am saving transform position and rotation, and all the components and their values to a custom made saving file.
It looks pretty much like this,
Player
pos.x = 100
pos.y = 100
pos.z = 100
rot.x = 100
rot.y = 100
rot.z = 100
(c) // Reader reads this line and knows the next following is components
Health // Gets the name of the Component (which in this case is HEALTH.
true // this is to determine if it's enabled or not (which works).
100 // 100 Health
(c/) // Means we are done with components.
The //Comments are just so you know what things are, it’s not saved in the save.
What I need to figure out is the last thing inside the save file.
The
100
I need to sync that to the proper variable, but I’m not sure how that’s doable. I know it is, just need a bit of guidance.