Topic was automatically imported from the old Question2Answer platform.
Asked By
Animabis
Hello everyone,
I am used in vba to use defined variables a lot, it looks like this:
Type Data_Player ' Create user-defined type.
Ref As Integer ' Define elements of data type.
Name As String
Color As String
End Type
Sub CreatePlayer()
Dim Player_0 As Data_Player ' Declare variable.
Player_0.ID = 0 ' Assign a value to an element.
End Sub
This is particularly useful for defining parameters to be sent to the different instances of an object, I suppose that this involves the creation of a node but that it is the best practice ?
You can use node if you know all your keys beforehand or Dictionary if you want to have dynamic keys. In case of dictionary, you will still have to create node with this dictionary as variable.
Also note that it is possible to create script that does not extends Node at all, but you will not be able to add this script to scene directly (but you can create node and make variable that will use this script).
Hi Alex,
Thank you very much for your answer ! it’s unfortunate that this is not possible, but the result is similar by creating instances of a node containing multiple variables. I prefer to avoid Dictionary, it tends to increase the number of containers and make things a little bit laborious…