I am having an issue implementing the following script into my game. I am an artist, not a coder… I am just starting out with C#, and really do not know much yet.
I currently have a free bezier pathing script package that I installed, but decided to go with iTween instead.
My game works with the Bezier scripts, but will not work with the iTween script. The iTween script works in it’s own “project”, but not in my game project, and I just am not knowledgeable yet to understand why.
My game project does include iTween and uses it for pathfinding. All of that works properly.
If anyone can point out the problem, and/or maybe offer an explanation why the error occurs, it would be a very helpful.
Thanks ahead of time, and please excuse my total lack of knowledge… I’m just starting out.
-Kory
error CS0120: An object reference is required to access non-static member ‘iTweenPath.GetPath()’
using UnityEngine;
using System.Collections;
public class SpawnShipFollowPath : MonoBehaviour {
// Use this for initialization
void Start () {
{
iTween.MoveTo(gameObject, iTween.Hash("path", iTweenPath.GetPath("ShipPath1"), "time", 40, "easetype", iTween.EaseType.linear, "orientToPath", true, "looptype", iTween.LoopType.loop));
}
}
// Update is called once per frame
void Update () {
}
}
I believe the problem is occurring because the script cannot referenceiTween.
Check the documentation and see if you must call something, such as “using iTween” or reference a manager script via code such a “GetComponent(iTweenScript)”.
I’ve never used iTween, but see if you can find the solution there.
Use getcomponent, unity doesnt like, if you areonly referencing to a script, notto an attached component of a gameobject,example:
If you have the script:iTween in a gameobjext called: examplegameobject, then use GameObject.Find(“examplegameobject”).GetComponent.() save this to a variable, like iTw, and use thaf instead of iTween.somefunctions