Du bist nicht angemeldet.

Stilllegung des Forums
Das Forum wurde am 05.06.2023 nach über 20 Jahren stillgelegt (weitere Informationen und ein kleiner Rückblick).
Registrierungen, Anmeldungen und Postings sind nicht mehr möglich. Öffentliche Inhalte sind weiterhin zugänglich.
Das Team von spieleprogrammierer.de bedankt sich bei der Community für die vielen schönen Jahre.
Wenn du eine deutschsprachige Spieleentwickler-Community suchst, schau doch mal im Discord und auf ZFX vorbei!

Werbeanzeige

1

07.06.2020, 16:59

Unity3D EditorScript is instantiated multiple times and resets all script variables?

Since I have made this post already in English, pls understand that I am to lazy to translate back to german text and I just refer to this thread posted ^^

Where as mentioned in the title, that any custom editor script is called multiple times when u click on an item in the hierarchy window.

Also, the "OnGUI" call is called way to often EVEN when I am checking for input, that it shall not get called when some input is not sent.

have a look here:

https://answers.unity.com/questions/1739…e-than-1-t.html


For any help I am much appreciated since it drives me crazy and I dont know what to do to make that call only happen once!

best regards

Monka


PS: the script header looks like:

[CustomEditor(typeof(PlaceHolderForPrefabs)), ExecuteInEditMode()] //PlaceHolderForPrefabs --_> Only prefabs with this script attached shall be recognized by this custom editor!
public class PrefabManager : Editor
»MonkaBoy« hat folgendes Bild angehängt:
  • way to many gui calls.PNG

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »MonkaBoy« (07.06.2020, 17:15)


2

07.06.2020, 17:34

In jQuery gibt es eine .one() - Methode, um sicherzustellen, dass der Trigger genau einmal beim Klicken ausgelöst wird.
Andernfalls wird der Trigger solange ausgelöst, bis der Mausklick beendet ist (MouseUp). Das kann sich in Sekundenbruchteilen ganz schön zusammenläppern.
Vermutlich brauchst du ein Äquivalent für Unity (MonoBehavior ?, ich hab keine Ahnung von Unity)
oder schreibst was Eigenes.
fka tm

3

09.06.2020, 19:19

Hi michael, ja so einfach ist das leider net in Unity3D , aber ich habe es mit einen workaround gelöst, nicht die beste Sache aber geht jetzt gewissermassen, ioch danke dir trotzdem für deine Unterstützung.

Werbeanzeige