Although I’m not programmer, I want to make the demo that controls animation with UI slider, like below.
I tried the script in the above, but it didn’t work. The following is Error message.
If anyone know how to solve, please tell me.
version : Unity 5.1.1 p
— Error 1
UnityException: You are not allowed to call this function when declaring a variable.
Move it to the line after without a variable declaration.
If you are using C# don’t use this function in the constructor or field initializers, Instead move initialization to the Awake or Start function.
UnityEngine.GameObject…ctor (System.String name) (at C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineGameObjectBindings.gen.cs:414)
ScrollbarAction…ctor () (at Assets/ScrollbarAction.js:5)
— Error 2
Internal_CreateGameObject can only be called from the main thread.
Constructors and field initializers will be executed from the loading thread when loading a scene.
Don’t use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.
— Error 3
ArgumentException: Internal_CreateGameObject can only be called from the main thread.
Constructors and field initializers will be executed from the loading thread when loading a scene.
Don’t use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.