- Home /
Die Frage ist beantwortet, die korrekte Antwort wurde akzeptiert
LineRenderer crashes the Update function
Hello,
I wanna develop a tower defense game and I wanna create a circle of a turret witch show the player the range of the turret.
Therefore I have two prefabs and two classes. The first prefab and class is the turret itself and the second is the node.
On this picture you can see the game view on itch.io. The turret follow the enemy and shot, if the enemy is in the range of one turret.
So if I click again on the turret, it should be come a red circle, but on itch, the turrets stands still.
The turret prefab has a LineRenderer and a function with the name OnRenderer() and the function call is in the Update() function.
void Update() {
if (isClicked) {
OnRenderer();
}
}
....
In the node class, there is an OnMouseOver() function, this function placed the turret and if the turret placed and I clicked again on this node; I search all objects with the same tag and set the isClicked = true. Normally after the second click there should the red circle around every turret.
In the Unity Editor and in the Unity GameView everything runs correct, but only on the website of itch, there is the problem.
I hope anybody can help me.