r/Unity3D – Telegram
r/Unity3D
265 subscribers
12.7K photos
15.6K videos
14 files
48K links
News about the Unity engine and project showcases from Reddit. Made possible with @reddit2telegram (@r_channels).
Download Telegram
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
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
Switching from GameMaker to Unity.
https://redd.it/1h3yvla
@r_Unity3D
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
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
This media is not supported in your browser
VIEW IN TELEGRAM
Provencal atmosphere🥰from our little game ☀️Petite Petanque☀️
https://redd.it/1h414mc
@r_Unity3D