Hello all,
I have a question about scriptable objects variables. I have demonstrated my program to a simpler one that pin points exactly my problem.
I have created a Scriptable Object of the ScriptObject class and set numberInteger to 10 in the editor. I have attached the Scriptable Object to the Test field. When I run it, the int number that is being passed to Number constructor is 0, as the default in the definition of numberInteger.
What change shall I do to pass the reference as I have it in the editor?
Thank you,
John
public class Test : MonoBehaviour
{
public ScriptObject scriptObject;
}
[CreateAssetMenu]
public class ScriptObject : ScriptableObject {
public int numberInteger;
public Number number;
public ScriptObject()
{
this.number = new Number(this.numberInteger);
}
}
public class Number
{
public Number(int number)
{
Debug.Log(number);
}
}