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
using Unity.Entities; | |
using UnityEngine; | |
using UnityEngine.UI; | |
public class PlayerHealthUIAuthoring : MonoBehaviour, IConvertGameObjectToEntity | |
{ | |
[SerializeField] | |
TMPro.TMP_Text _uiText; | |
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem) |
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 class PlayerInputSystem : SystemBase | |
{ | |
Controls _controls; | |
InputAction _moveAction; | |
protected override void OnCreate() | |
{ | |
_controls = new Controls(); | |
_controls.Enable(); | |
_moveAction = _controls.Default.Move; |
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
using NUnit.Framework; | |
using System.Runtime.InteropServices; | |
using Unity.Entities; | |
using UnityEngine; | |
// Credit to https://github.com/5argon/EcsTesting\ | |
public class ECSTestBase | |
{ | |
protected World World { get; private set; } | |
protected EntityManager EntityManager => World.EntityManager; |
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
using NUnit.Framework; | |
using Unity.Collections; | |
using Unity.Entities; | |
using Unity.Jobs; | |
[TestFixture] | |
public class EntityTransactionTests | |
{ | |
struct SomeComponent : IComponentData | |
{ } |
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
using System.Collections; | |
using System.Collections.Generic; | |
using Unity.Entities; | |
using UnityEngine; | |
struct FixedRateTestUtilsTest : IComponentData | |
{ } | |
class FixedRateSystemGroup : ComponentSystemGroup | |
{ |
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
using NUnit.Framework; | |
using System.Collections; | |
using System.Collections.Generic; | |
using Unity.Entities; | |
using UnityEngine; | |
namespace ECBEntityRefTests | |
{ | |
struct CompA : IComponentData | |
{ |
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
using System.Collections; | |
using System.Collections.Generic; | |
using Unity.Collections; | |
using Unity.Entities; | |
using UnityEngine; | |
public class GlobalArray | |
{ | |
public static NativeArray<int> Array; | |
} |
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
using System.Collections; | |
using System.Collections.Generic; | |
using Unity.Burst; | |
using Unity.Collections; | |
using Unity.Entities; | |
using UnityEngine; | |
public class FunctionPointerOnComponents : SystemBase | |
{ | |
[BurstCompile] |
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
// Sort so that players are first, and everything else is sorted by speed | |
struct PlayerSpeedSort : IComparer<Entity> | |
{ | |
ComponentDataFromEntity<Speed> speedFromEntity; | |
ComponentDataFromEntity<Player> playerFromEntity; | |
public PlayerSpeedSort(ComponentDataFromEntity<Speed> speedFromEntity, ComponentDataFromEntity<Player> playerFromEntity) | |
{ | |
this.speedFromEntity = speedFromEntity; | |
this.playerFromEntity = playerFromEntity; |
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
protected override JobHandle OnUpdate(JobHandle inputDeps) | |
{ | |
var ints = new NativeList<int>(Allocator.TempJob); | |
inputDeps = new IntJob | |
{ | |
ints = ints | |
}.Schedule(inputDeps); | |
inputDeps = new Reader |
NewerOlder