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 RotatorScalerSystem : SystemBase | |
{ | |
private EntityQuery entityQuery; | |
// ... | |
[BurstCompile] | |
struct ScalerAndRotatorJob : IJobChunk | |
{ | |
//... |
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 RotatorScalerSystem : SystemBase | |
{ | |
private EntityQuery entityQuery; | |
// ... | |
protected override void OnCreate() | |
{ | |
base.OnCreate(); |
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; | |
[GenerateAuthoringComponent] | |
public struct Rotator : IComponentData | |
{ | |
public float Speed; | |
public float Angle; | |
public bool Enabled; | |
} |
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 ZTranslationSystem : JobComponentSystem | |
{ | |
[BurstCompile] | |
[RequireComponentTag(typeof(CubeComponent))] | |
struct TranslateJob : IJobForEach<Translation, MoveSpeedComponentData> | |
{ | |
[ReadOnly] | |
public float DeltaTime; | |
[ReadOnly] |
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; | |
public class Cube : MonoBehaviour, IConvertGameObjectToEntity | |
{ | |
public void Convert(Entity entity, EntityManager entityManager, GameObjectConversionSystem conversionSystem) | |
{ | |
entityManager.AddComponent(entity, typeof(CubeComponent)); | |
entityManager.AddComponentData(entity, new MoveSpeedComponentData { Value = Random.Range(0.1f, 1.0f) }); | |
} |
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; | |
using Unity.Entities; | |
[Serializable] | |
public struct CubeComponent : IComponentData { } | |
[Serializable] | |
public struct MoveSpeedComponentData : IComponentData | |
{ | |
public float Value; |
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 URPTestTwo : MonoBehaviour | |
{ | |
private EntityManager _entityManager; | |
[SerializeField] | |
public GameObject Prefab; | |
[SerializeField] | |
public int NumberOfObjects = 1000; | |
[SerializeField] | |
public int XSpread = 10; |
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 Assets.Scripts.Classes; | |
using Unity.Burst; | |
using Unity.Collections; | |
using Unity.Jobs; | |
using Unity.Mathematics; | |
[BurstCompile] | |
public struct ZTranslationJob : IJobParallelFor | |
{ | |
public NativeArray<float> MoveSpeeds; |
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
// Use Entity instantiation. | |
private void Start() | |
{ | |
// ... | |
var settings = GameObjectConversionSettings.FromWorld(World.DefaultGameObjectInjectionWorld, null); | |
_entityManager = World.DefaultGameObjectInjectionWorld.EntityManager; | |
var entity = GameObjectConversionUtility.ConvertGameObjectHierarchy(ObjectToMove, settings); | |
for (var i = 0; i < NumberOfObjects; i++) |
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
// Use plain GameObject instantiation. | |
private void Start() | |
{ | |
// ... | |
Transform instance = Instantiate( | |
ObjectToMove, | |
new Vector3(UnityEngine.Random.Range(-XSpread, XSpread), | |
UnityEngine.Random.Range(-YSpread, YSpread), | |
UnityEngine.Random.Range(-ZSpread, ZSpread)), Quaternion.identity); | |
// ... |
NewerOlder