Hey guys!
I would like to add attribute which allows to choose tween easing function:
SomeScript.attributes.add('easing', {
type: 'string',
enum: [
{ 'Linear': 'Linear' },
{ 'SineIn': 'SineIn' },
........
]
});
Obviously, that works fine.
But as soon as I want to add the same attribute to another script, I face a problem.
To avoid code repeating, it would be great to export enum’s content to some constant and use it by reference:
var Constants = pc.createScript('constants');
Constants.EASINGS = [
{ 'Linear': 'Linear' },
{ 'QuadraticIn': 'QuadraticIn' }
];
and then use it everywhere:
AnotherScript.attributes.add('easingFunction', {
type: 'string',
enum: Constants.EASINGS
});
Sounds fine, right?
No. Everything works in the game, but not in the editor. Every time I click parse on the script, I get an error:
So the question is next: Is there any way to declare a variable which will be visible and accessible from both game’s and editor’s context?