Skip to content

Instantly share code, notes, and snippets.

View rapushka's full-sized avatar
🎮
gamedev

Rapuška rapushka

🎮
gamedev
  • FuryLion
  • Navapolacak, Belarus
  • 16:48 (UTC +03:00)
View GitHub Profile
@rapushka
rapushka / EntityParenthoodDebugger.cs
Created March 23, 2025 19:18
EntityParenthoodDebugger Keeps the `Entitas.VisualDebugging.EntityBehaviour`'s hierarchy as it is in your ECS world. if you use some kind of Child-Parent Relationship Components
// notes: EntityID is just wrapper around int, and ID is Component with [PrimaryEntityIndex] EntityID
// and ChildOf is [EntityIndex] EntityID
// this code uses mine Entitas.Generic
// if you wanna use this one with usual Entitas - just replace `Entity<GameScope>` with `GameEntity` and stuff
public class EntityParenthoodDebugger
{
// Key: entity; Value: its parent
private readonly Dictionary<EntityID, EntityID> _processedEntities = new();
@rapushka
rapushka / RecursiveNameOf.cs
Created February 12, 2023 13:44
Recursive nameof
public static (string, T) RecursiveNameOf<T>(Expression<Func<T>> expression)
{
var nameOfVariable = ((MemberExpression)expression.Body).Member.Name;
var value = expression.Compile().Invoke();
return (nameOfVariable, value);
}