- Home /
Question by
siddharth3322 · Feb 24, 2014 at 06:29 AM ·
c#staticunity4.3constant
Vector3 as Constant in Script
I want to define Vector3 as per following manner.
public static class Constants
{
public readonly Vector3 INITIAL_OBJECT_SCALE = Vector3.one;
}
I want to access my constant Vector3 variable as
Constant.OBJECT_INITIAL_SCALE
So what is the way to achieve this?
static instance.png
(8.9 kB)
Comment
Best Answer
Answer by whydoidoit · Feb 24, 2014 at 06:31 AM
public static readonly INITIAL_OBJECT_SCALE = Vector3.one;
You still have to make static class members static
Any of the method not working for me. Please check it.
This works for me:
public static class Constants {
public static readonly Vector3 someVector = Vector3.one;
}
public class Something {
public Vector3 whatIsThis = Constants.someVector;
}
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Save static fields values 1 Answer
how to acess Static variable in other scripts without extended functions? 2 Answers
cannot implicitly convert type 'int' to 'bool' problem 1 Answer