This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} |