Jump to content

Names as string[] array instead of string for Nodes


photo

Recommended Posts

Good morning,

How can I change the names of objects to be as a string[] array instead of just string? If I create many objects and I need to detect their names as a path then it would be at O(1) speed to get names for the objects by using arrays than parsing a string with split. For example:

Path string:

string name = "sphere/1"

path string[]

string[] name = new string[]{"sphere","1"}

If I have many objects, it would be more efficient to use name[0] to check where the object belongs to than to use name.Split() no?

So how do I change the source files in Unigine to achive that?

image.png.232fcbca47b4df2f370374a095c830d0.png

I tried this:

image.png.90f414e2f21b52223de6c5345db84a39.png

but it gives the error:

image.png.fc8ec7a3bef9120f4d334cacbc4993f6.png

image.png.cc54a1ca5409e4f4f8248742939037af.png

Or how can I add an extra struct to the Node so that I can create additional data? for example, name2

Edited by Sevdat
Link to comment

Hello.

The name inside the engine is a string. and unfortunately there is no way to change this.

-----------
alternatively, you can look towards "extension methods"
in c# or other "dirty" hacks

https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/extension-methods

https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/how-to-implement-and-call-a-custom-extension-method

 

Link to comment
Posted (edited)
On 7/22/2024 at 10:39 AM, cash-metall said:

Hello.

The name inside the engine is a string. and unfortunately there is no way to change this.

-----------
alternatively, you can look towards "extension methods"
in c# or other "dirty" hacks

https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/extension-methods

https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/how-to-implement-and-call-a-custom-extension-method

 

Good day cash metall,

I wrote every possible combination. I used namespace, classes, static etc. I can't even get it to appear here:

image.thumb.png.92de4cbe00aebdf729d1662016fbe71e.png

image.png.a4f7af82a9988de029046e780977ee7e.png

image.png.436d61706b4e188cc47f270cf5fc2b65.png

Edited by Sevdat
Link to comment
×
×
  • Create New...