- Home /
Question by
Deridealized · Feb 26, 2020 at 08:19 PM ·
instantiateaccess
Instantiated Object returning strange values (with picture)
Hi,
I have an instantiated player inside of which there is a currentDrift value which decreases when holding leftShift.
The mechanics work fine so the value works fine (As shown at the top of the image below).
Why is it then, that when accessing this script from my UI script the value only returns as 1 and never changes (as show in the console below). - as such my UI doesn't show the value changing.
Both are returning the currentDrift variable from the same script.
Top part of image shows highlighted instantiated player Console window is me running playerScript.Test() { dlog(currentDrift) } from the UI script.
Any help would be greatly appreciated.
Thanks
driftvalue.png
(24.1 kB)
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612224027im_/https://answers.unity.com/themes/thub/images/avi.jpg)