void OnDestroy() { Util.Log($"PlayerBody on actor {voosActor.GetDebugName()} destroyed"); }
private void HandleModuleCompileError(VoosEngine.ModuleCompileError error) { string behaviorUri = error.moduleKey; var beh = behaviorSystem.GetBehaviorData(behaviorUri); var meta = JsonUtility.FromJson <BehaviorCards.CardMetadata>(beh.metadataJson); HashSet <string> usingBrainIds = new HashSet <string>(from entry in behaviorSystem.BrainsForBehavior(behaviorUri) select entry.id); VoosActor oneActor = (from actor in voosEngine.EnumerateActors() where usingBrainIds.Contains(actor.GetBrainName()) select actor).FirstOrDefault(); string actorsUsing = oneActor == null ? "No actors using it" : $"One actor using it: {oneActor.GetDebugName()}"; string msg = $"<color=yellow>Error with card '{meta.cardSystemCardData.title}' (line {error.lineNum}). {actorsUsing}. The error:</color>\n<color=red>{error.message}</color>"; CommandTerminal.HeadlessTerminal.Buffer.HandleLog(msg, TerminalLogType.Error, null); // NOTE: Ideally, we'd do this if we know the code editor isn't viewing this particular behavior if (Time.timeSinceLevelLoad < 5f && (!IsCodeEditorOpen() || error.lineNum == -1)) { popup.Show($"There was an error with card '{meta.cardSystemCardData.title}' (line {error.lineNum}):\n{error.message}\n<color=#666666>{actorsUsing}.</color>", "OK", null, 1400f); } }