- Home /
Can I make variables depend on eachother before running the game
Hello,
I'm using this function
AnimationCurve EaseInOut(float timeStart, float valueStart, float timeEnd, float valueEnd);
how can I achieve something like this:
public float x; publix float y; public float z; public float w;
AnimationCurve EaseinOut(x, y, z, w);
so when I click the animation curve editor before running the game, the length and height of the graph will depend on the values I put in in the inspector.
Unity says 'Assets/DOOR SCRIPT/SCRIPTS/Door.cs(16,70): error CS0236: A field initializer cannot reference the nonstatic field, method, or property `Door.x''
but is there any workaround?
Answer by ZBlaxland · Oct 17, 2016 at 05:00 AM
Does this help at all? http://answers.unity3d.com/questions/1020753/error-a-field-initializer-cannot-reference-the-non-1.html
I'm not sure what you're asking, but give it a shot and see if that works :D
Hey! Unfortunately I need it to happen before the start function :) but if you're wondering, this post answered my question
http://answers.unity3d.com/questions/19171/calculate-things-and-display-in-inspector.html
Your answer
![](https://koobas.hobune.stream/wayback/20220612094747im_/https://answers.unity.com/themes/thub/images/avi.jpg)