I want get properties in class Decay, but i no have access.
http://dl1.joxi.net/drive/0003/0441/229817/151027/978ed087bf.jpgCode:private float lastDecayTime; private float lastTouchedTime;
Change private -> public please =)
Solved Getting lastDecaytime?
Discussion in 'Rust Development' started by miRror, Oct 28, 2015.
-
Wulf Community Admin
Use reflection to get it.
-
-
@miRror Did you do this ?
I tried trying to use Reflection for my first time .. and it didnt go well(I read some tutorials too).... could you give me an example of how it would go ? -
Wulf Community Admin
-
Code:private FieldInfo lastTouchedTime = typeof(Decay).GetField("lastTouchedTime", (BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.NonPublic | BindingFlags.GetField));
Use in my example:
Code:Decay decay = block.GetComponent<Decay>(); lastTouchedTime.GetValue(decay); // getting value variable lastTouchedTime in class Decay