Questions tagged [events]
Event is action that is usually happenes "outside" of main program thread, but handled inside of it.
282 questions
11
votes
1
answer
1k
views
Destroying the parent when all children are destroyed
I have a spell system where a the spell is a self-contained game object handling all the logic. When done, it destroys itself. This works great
Then I added a second game object handling animation, ...
1
vote
0
answers
43
views
How to Handle Intermediate State in Event-Sourced Game Architecture for Complex Command Logic
I'm building a turn-based game using an event-sourced-ish architecture. Here's the basic structure:
A dispatcher on the game engine receives commands from the client and routes them to command ...
0
votes
1
answer
91
views
Assigning action without creating closure
I am trying to create a system for daily events in Unity, but I am facing an obstacle where performance and memory are very sensitive for me,The DailyEvent consists of a list of DailyEventAction, ...
0
votes
1
answer
88
views
Public method doesn't show up as a selectable option in a button's On Click event
I have the following public method in a MonoBehaviour attached to a game object in my scene:
...
0
votes
1
answer
105
views
Best way to code event system that has both one-to-one subscription and one-to-several subscription?
I'm trying to create an event system that can be used for all types of events that happen in my game but I'm running into this following problem.
My player HUD needs to be updated whenever an enemy ...
0
votes
0
answers
57
views
UI Toolkit event doesn't let me finish writing the value
I use an integer field to indicate the value of the wanted year and I set a maximum and minimum limit for it and I wanted a function to be called when the wanted year value changes to display the ...
0
votes
1
answer
293
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(...
1
vote
1
answer
636
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 ...
0
votes
1
answer
544
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 ...
0
votes
1
answer
66
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, ...
0
votes
0
answers
83
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 ...
0
votes
1
answer
46
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 ...
0
votes
1
answer
2k
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 ...
0
votes
0
answers
127
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 ...
2
votes
0
answers
270
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 ...
1
vote
0
answers
609
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 ...
0
votes
1
answer
466
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: ...
0
votes
0
answers
69
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 ...
0
votes
2
answers
1k
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 ...
0
votes
0
answers
164
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 ...
0
votes
1
answer
2k
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?
2
votes
2
answers
2k
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:
...
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 ...
1
vote
0
answers
519
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 ...
6
votes
1
answer
7k
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
...