This media is not supported in your browser
VIEW IN TELEGRAM
Elephant Boss: Guardian of the desert. He's too heavy to dodge your attacks, but his immense strength makes him tough to beat!
https://redd.it/1h3xcut
@r_Unity3D
https://redd.it/1h3xcut
@r_Unity3D
How to convert this class so i can use it with ecs
public class NodesMono : MonoBehaviour
{
public NodesMono NextNode,PreviousNode,IntersectionNode;
}
i want to bake this into an entity so i can make an array out of it and use in a system.
If anyone would be so kind to give me a rough idea on how to do it.
(i know about the baking part i just dont know how to make it as a component on an entity.)
🤧🤧🤧 tanks.
some more dumbahh code for context
using Unity.Entities;
using UnityEngine;
public class PedestrianManager : MonoBehaviour
{
public NodesMono nodesArray; // Array to store NodesMono objects
private void Start()
{
nodesArray = GameObject.FindObjectsByType<NodesMono>(FindObjectsSortMode.None);
Debug.Log("Found " + nodesArray.Length + " NodesMono objects.");
}
}
// This class is where the conversion from MonoBehaviour to Entity happens
class WaypointsBaker : Baker<PedestrianManager>
{
public override void Bake(PedestrianManager authoring)
{
// Iterate over each NodesMono object
foreach (var node in authoring.nodesArray)
{
// Create an Entity for each Node
Entity nodeEntity = GetEntity(TransformUsageFlags.Renderable);
var nodeComponent = new Node
{
NextNode = node.NextNode, // idk wut to put here
IntersectionNode = Entity.Null,
PreviousNode = Entity.Null
};
AddComponent(nodeEntity, nodeComponent);
}
}
}
// Data structure representing the node
public struct Node : IComponentData
{
public Entity NextNode;
public Entity IntersectionNode;
public Entity PreviousNode;
}
https://redd.it/1h3wcjj
@r_Unity3D
public class NodesMono : MonoBehaviour
{
public NodesMono NextNode,PreviousNode,IntersectionNode;
}
i want to bake this into an entity so i can make an array out of it and use in a system.
If anyone would be so kind to give me a rough idea on how to do it.
(i know about the baking part i just dont know how to make it as a component on an entity.)
🤧🤧🤧 tanks.
some more dumbahh code for context
using Unity.Entities;
using UnityEngine;
public class PedestrianManager : MonoBehaviour
{
public NodesMono nodesArray; // Array to store NodesMono objects
private void Start()
{
nodesArray = GameObject.FindObjectsByType<NodesMono>(FindObjectsSortMode.None);
Debug.Log("Found " + nodesArray.Length + " NodesMono objects.");
}
}
// This class is where the conversion from MonoBehaviour to Entity happens
class WaypointsBaker : Baker<PedestrianManager>
{
public override void Bake(PedestrianManager authoring)
{
// Iterate over each NodesMono object
foreach (var node in authoring.nodesArray)
{
// Create an Entity for each Node
Entity nodeEntity = GetEntity(TransformUsageFlags.Renderable);
var nodeComponent = new Node
{
NextNode = node.NextNode, // idk wut to put here
IntersectionNode = Entity.Null,
PreviousNode = Entity.Null
};
AddComponent(nodeEntity, nodeComponent);
}
}
}
// Data structure representing the node
public struct Node : IComponentData
{
public Entity NextNode;
public Entity IntersectionNode;
public Entity PreviousNode;
}
https://redd.it/1h3wcjj
@r_Unity3D
Reddit
From the Unity3D community on Reddit
Explore this post and more from the Unity3D community
My starlit sky scene in Unity 6. Never seen a sky like this in real life since I moved to the city, so bad.
https://redd.it/1h3y2mt
@r_Unity3D
https://redd.it/1h3y2mt
@r_Unity3D
Media is too big
VIEW IN TELEGRAM
Still working on and expanding the build mode and smart npcs. Do you like where this is going? WIP
https://redd.it/1h3zpkp
@r_Unity3D
https://redd.it/1h3zpkp
@r_Unity3D