Unity Learn home
3
3
Museum video walk through
128 views
This walk through was made using the photography of one of my students, Idil Meric. Originally the text was only working on the lake painting, but for some reason it is now only working on the dragon painting. I am not sure why or how to fix it so all paintings display their relevant information.
Media
1
1
LM
Laura Masbruch
5 years ago
I struggled with the script as well. At first the text for the first item never went away, so I added an else that would clear the text fields when I walked away. That worked, but then text would not show up for the rest of my displayed items. After closing Unity and restarting it, suddenly everything was working. (I did delete the else.)
HC
Hui Chen
5 years ago
I have added a bool private bool isCurrentText = false; and my Update looks like this now: if (other) { float dist = Vector3.Distance(other.position, transform.position); print("Distance to other: " + dist); if (dist < 8) { myTitle.text = newTitle; myAuthor.text = newAuthor; myDesc.text = newDesc; isCurrentText = true; } else if(dist > 8 && isCurrentText) { myTitle.text = ""; myAuthor.text = ""; myDesc.text = ""; isCurrentText = false; } }
HC
Hui Chen
5 years ago
(edited)
I have the same problem and I think there is a problem with the script. With the current proximity script, there will always be only one plane working as expected - which is the last one that is updated. All planes try to override the same text fields, so when the player is close to pictureA, then pictureB will tell the program that the player is too far away from pictureB and put "" empty text fields into the text fields.