Questions tagged [events]

Event is action that is usually happenes "outside" of main program thread, but handled inside of it.

Filter by
Sorted by
Tagged with
0 votes
0 answers
28 views

What do you do with SDL2 events?

I have the typical/basic event loop for SDL2 and I'm a little confused on what to do with them or how to handle them or I guess more specifically how should I get the data from these events (e.g ...
Konjointed's user avatar
0 votes
1 answer
75 views

Sanity Check on my Idea for an Event System for game

So, I recently started making a small game from scratch, with no engine used(I'm a beginner at this) and I want to create an event system of my own. I want to check if my general idea for it is okay(...
HavocKid's user avatar
0 votes
0 answers
71 views

How to implement events with ECS?

I'm transitioning over to an ECS architecture for a small C++ graphics engine I'm working on and I'm a bit stumped on how to tackle events. One solution I came across was from this Reddit post ...
Konjointed's user avatar
0 votes
1 answer
39 views

Infinite character loop when trying to play Dialogue

I am trying to make a dialogue system in Unity by following this tutorial: (29) 5 Minute DIALOGUE SYSTEM in UNITY Tutorial - YouTube. There is a slight twist to this and that is that I am triggering ...
Akshit Chaturvedi's user avatar
1 vote
1 answer
371 views

Area2D only detecting body_exited once

I am new to game development, I am practicing by creating a pong game. I currently have an Area2D set up with a signal listening for ...
zeroparity's user avatar
1 vote
0 answers
69 views

2D grid game server - interaction system/dynamic blocks

I'm building a Server-side engine for 2D sandbox game similar to Terraria or Starbound. The language I use is Dart (similar to JavaScript or C#). Currently I'm trying to figure out how to make a good ...
Zekfad's user avatar
  • 11
0 votes
1 answer
200 views

Clicking UI button calls event twice

I've designed a game where, when a button is clicked, the moving point stops. If the button is clicked again, the moving point starts moving again. I only click on the button once, but the ...
Alisa's user avatar
  • 1
0 votes
1 answer
277 views

How to design an EventBus(guided by the pub/sub pattern)

I'm working on my game engine, and was faced with the fact, that i don't know how properly design an event system. As a pattern i choose Pub/Sub with an event bus, but i don't know where i should '...
qulop's user avatar
  • 3
0 votes
1 answer
37 views

3rd Button on UI Seems to not Register the onClick.AddListener()

I have a UIManager meant to control the UI. The UI manager is attached to an empty game object. The Canvas has three panels, ...
Tim W Glass's user avatar
0 votes
0 answers
36 views

Collision detection and damage using call method track

I'm currently implementing damage similar to these two examples, putting the damage logic inside the "call method" track of the player animation. The problem is that sometimes the game just ...
Cei's user avatar
  • 863
0 votes
0 answers
30 views

How to make detail tab show information about clicked card?

I'm attempting to create a card game as a new Unreal Dev. Currently I have a UI for the board. That UI has children for the Hands, Field, and Card Details (A window to the side of the field that has a ...
GodelComplete's user avatar
1 vote
1 answer
446 views

Event listeners in code vs persistent event listeners inspector

This is by far the biggest thing I always find myself going in circles over and can never seem to find an approach I'm happy with - setting up regular UnityEvent listeners from code vs. setting up &...
Kevin's user avatar
  • 5,734
0 votes
1 answer
28 views

Assistance with State Machine Event subscription error? [closed]

My aim is to create events within my various states that will broadcast to other GameObjects when to take certain actions and to send certain data without needing to reference each GameObject. I have ...
ssnssnss's user avatar
0 votes
2 answers
1k views

How to get the name of a function added as a listener to a Button's onClick event?

If my button uses AddListener to subscribe a function to listen for clicks: mybutton.onClick.AddListener(getNameFunction); Is there a way to get the name of that ...
jasmine zhao's user avatar
0 votes
1 answer
1k views

UI Toolkit not firing button clicked event

I'm using the new UI Toolkit and new Input System together, and I've setup everything correctly the Input Actions has separate input for UI, the Input System UI Input Module is setup correctly, the ...
Džoni's user avatar
  • 36
0 votes
1 answer
2k views

Is it necessary to unsubscribe from C# events when the event owner has already been destroyed?

The following code throws a null reference exception when I stop the project because touchInterfaceController has already been destroyed. ...
arcadeperfect's user avatar
0 votes
0 answers
108 views

AddListener to Button in Prefab

I created a prefab called MapNode and have MapGenerator instantiate a bunch of them at runtime. I want to make the each instance ...
qjk's user avatar
  • 1
0 votes
0 answers
605 views

Events and Entity Component Systems?

What are common ways to implement Events in an entity component system ? Most games typically have following events : Damage Events Collision Events Area of interest Events Entity Died/Respawn events ...
genaray's user avatar
  • 517
2 votes
0 answers
192 views

Scheduler for Event Driven Behaviour Tree

The Behaviour Tree Starter Kit (BTSK) on GameAI Pro suggests using a scheduler for an event driven behaviour tree. To recap: A behaviour tree (BT) is traversed fully every time the root node is ticked ...
Ralph's user avatar
  • 23
0 votes
0 answers
316 views

Will using static events and static instances of a class in multiplayer game in unity cause problems?

I am working on a game system that partly relies on static events and static instance of a class (so not Singleton or static class but just static instance of a class). I am not sure if my system will ...
Ivan's user avatar
  • 317
1 vote
0 answers
486 views

How to distinguish pointer up inside button vs drag-out

I am making a unity mobile game, I have a simple scene and a canvas with a few buttons and these buttons have scripts that detect if the button was pressed and released. Here is the code for doing ...
zmac's user avatar
  • 11
1 vote
1 answer
122 views

When detecting a keyboard key is released. What happened if the key is released at the end of the game loop?

When detecting a keyboard key is released. What happened if the key is released at the end of the game loop, how could the pollEvent function, which is at the top of the game loop, and it is a brand ...
Đạt Phạm's user avatar
0 votes
1 answer
422 views

Reference as local variable in Unity c#

In the script below, "btn" is a local variable in OnEnable() method. It's said that local variable is deallocated (lost) when leaving the countaining method. Why this one (btn) is not ? Nb: ...
Achie1's user avatar
  • 169
0 votes
1 answer
134 views

How to handle mouse wheel events in the Pyxel game engine

I'm trying to handle mouse wheel input (aka scroll wheel) on a plain old mouse. if pyxel.btn(pyxel.MOUSE_WHEEL_Y): print(pyxel.mouse_wheel) This never triggers....
Arnaud Meuret's user avatar
0 votes
0 answers
52 views

Unity code design - Events

I am aiming to create a Unity project with a code structure similar to ECS. I want the code to be consistent, easy to integrate extend and expand if multiple developers will work with it. By that I ...
user159431's user avatar
0 votes
1 answer
429 views

Why does assigning an empty delegate to this Unity Event Action on construction make it work? (But it is dead/broken without it?)

I am learning about Actions/Events in Unity and just built a system around them which works. However, it seems I just got lucky and I'm not sure why. Roughly, my class in a simple illustrative form (...
mike's user avatar
  • 481
0 votes
2 answers
840 views

Optimal implementation for effects in a card game

I am working on a card game in Unity and want to implement a system where I can create card effects that happen when certain events are triggered. The events could be anything from when a card is ...
Owen Millward's user avatar
0 votes
1 answer
167 views

How to check whether the user completed their missions?

I am working on a coding/gaming application. I am currently stuck in the daily missions part. So, the user receives some missions each day, such as solving a problem, following another user, or ...
nour karoui's user avatar
0 votes
0 answers
106 views

Pygame unaccurate key press event handling

I have a problem with my game_over() function in Pygame. When the player loses, the game_over() function gets executed but since ...
Salem's user avatar
  • 226
0 votes
0 answers
749 views

How to handle various collision effects within an Entity Component System?

Let's say we have three enemies, a bear trap, a fire trap, and a minotaur. When you walk over the bear trap, the game spawns an invisible entity that, upon the player colliding with it, slows the ...
Ryan Peschel's user avatar
0 votes
1 answer
1k views

How could I intercept a save scene action being run in Unity?

How could I intercept a save scene action being run in Unity? There is some code I would like to run in editor whenever a scene is saved. Is it possible for me to detect somehow when a scene is saved?
qqqqqqq's user avatar
  • 278
0 votes
1 answer
140 views

Best way to handle events for a turn base game?

I'm looking for the best way to handle events for a tactic game in Unity. Every unit may need to react to different events (turn start, end, on damage to self, on damage to other, on kill, etc...). At ...
Federico's user avatar
2 votes
2 answers
1k views

Is it better to connect signals in source code or with the IDE feature?

In Godot IDE, what are the advantages and the caveats of using the visual IDE to connect signals to listerners instead of doing this: ...
pietrodito's user avatar
0 votes
1 answer
235 views

C# Events in Unity to separate GameObject features into Components

Broadly speaking, this is a question about how to separate my game object's code into distinct feature components that can be added and removed as needed. More specifically, I am trying to achieve ...
Ben's user avatar
  • 487
1 vote
1 answer
1k views

Method subscribed to an event is called twice for every time the event is raised [closed]

I am trying to make an inventory system in Unity with ScriptableObjects and a text driver that displays the contents of an inventory. So far the code looks like this: -An InventoryObject is defined as ...
IDieForShrek's user avatar
0 votes
1 answer
159 views

How to make a script on a prefab act on a particular scene instance?

I am building Actionables (Windmill, Coal) on a Planet by hovering the mouse over the Planet and clicking on it. Actionables are prefabs, which have an Actionable ...
sjaustirni's user avatar
1 vote
0 answers
370 views

How to design a character damage system with ECS architecture?

I am developing an game with ECS architecture and trying to design a character damage system. Does the following design fits into ECS conception and will it be extendable in future? I have an ...
Nikolai's user avatar
  • 27
0 votes
1 answer
1k views

Press and hold camera movement with mouse in new Input System?

I am transitioning to the new movement system and am having trouble figuring out how to move the camera when a mouse button is pressed and held. Here's how I did it before: ...
caleidon's user avatar
  • 561
6 votes
1 answer
5k views

How to correctly implement custom tick system?

I am making a custom tick system to suit my needs (calling normal ticks every 0.2 seconds, medium ticks every 5 seconds etc...) I followed the tutorial in this video: CodeMonkey tick system tutorial ...
caleidon's user avatar
  • 561
0 votes
1 answer
370 views

How to draw unity gizmos with new input system?

I am using the new Unity Input system for my game. When I press a key, for example "Q", I want gizmos to be drawn. However, I can't subscribe to a keypress event with a Gizmo drawing ...
caleidon's user avatar
  • 561
1 vote
1 answer
2k views

How to see which mouse button was pressed (Unity Input System)

I have switched my game to use the new Unity Input System, and I want to know which mouse button was pressed when an action is called. Here's how it's set up: Whenever one of these three mouse ...
caleidon's user avatar
  • 561
1 vote
1 answer
935 views

Unity InputSystem using Unity Events not maintaining values

I am testing out using the new Input System and cannot get the values from context.ReadValue<Vector2>() to pass into a private variable. The simple setup is ...
anothershrubery's user avatar
0 votes
1 answer
192 views

How to make an application architecture a global strategy game?

I am doing a global libgdx strategy, how can I properly design the architecture? So far, I'm in some kind of chaos, because there are different events that need to be shown to the player in the form ...
Степан Адамов's user avatar
0 votes
1 answer
188 views

Should UI systems update naively with events and data from outside, or should they be coupled to some game state/singleton to know to change itself?

I'm making a game in Unity for my game dev course in uni. I hope the question isn't too confusing but I have bolded sort of like a TLDR at the bottom. My level currently has a pregame UI panel, to set ...
yookakim's user avatar
2 votes
2 answers
11k views

How to call a function in response to a Button's OnSelect event?

I'm new to Unity and C# and have been struggling to figure out how to solve this. What I'm looking for is a way to make text display whenever a button is selected. (ex. Player selects a difficulty ...
FEZ_R's user avatar
  • 25
1 vote
1 answer
2k views

How would I go about adding a tooltip to a Unity UI Image?

I'm going to try out the community here once more, I haven't had very good look in the past with getting help. I'm iterating through a series of List() and I'm creating a bar graph and a line graph ...
John Connor's user avatar
1 vote
2 answers
2k views

OnMouse Events stop working when multiple cameras are active

I'm working on 2019.4.9f1 on a 2D project using Universal Rendering Pipeline. The camera settings changed so I'm stating it. I wrote a OnMouseEnter and ...
CraftedGaming's user avatar
1 vote
2 answers
77 views

Improving FPS by disabling unity events

I am trying to improve the fps and in my scene there are 4322 scripts attached to 4322 objects. When I activate those objects the fps go down. Right now it's around 100fps when i active those objects ...
Muhammad Faizan Khan's user avatar
1 vote
1 answer
752 views

Polling events with SDL results in stuttering response when dealing with multiple objects

I'm new to SDL programming and I'm not quite sure I got how it handles events. Given an instance like this defined in "game.c": ...
Gian's user avatar
  • 113
2 votes
3 answers
205 views

Multiple events based on in-game timer?

I've been thinking about how Zelda: Majora's Mask manages all its character events during the day and thinking about the best way to implement this. Initially I thought of each character entity ...
Forumpy's user avatar
  • 121

1
2 3 4 5 6