playMaker

Author Topic: PlayAnimation.cs error CS1061:  (Read 1327 times)

LaserSaber

  • Playmaker Newbie
  • *
  • Posts: 3
PlayAnimation.cs error CS1061:
« on: November 03, 2019, 05:40:33 PM »
I am trying to troubleshoot a Playmaker issue I ran into after installing this asset: https://assetstore.unity.com/packages/templates/systems/urban-traffic-system-2018-2-89133

Playmaker throws a bunch of errors (see attachment).

I have narrowed it down to this script: Assets\UTS_PRO 2018.4\Scripts\Street And Concert\PeopleController.cs
If I delete this script the playmaker errors go away:

using UnityEngine;
using System.Collections;

public class PeopleController : MonoBehaviour
{
   [HideInInspector] public float timer;
   [HideInInspector] public string[] animNames;
    [HideInInspector] public float damping;
    [HideInInspector] public Transform target;

   void Start()
   {
      Tick();
   }

   void Tick()
   {
      timer = 0;
      int randomAnim = Random.Range(0, animNames.Length);
      SetAnimClip(animNames[randomAnim]);
      timer = Random.Range(3.0f, 5.0f);      
   }

   public void SetTarget (Vector3 _target)
   {
          Vector3 targetPos = new Vector3(_target.x, transform.position.y, _target.z);
      transform.LookAt(targetPos);
   }

   void Update()
   {
      if(timer >= 0)
         timer -= Time.deltaTime;
      else
         Tick();

        if(target != null)
        {
            var lookPos = target.position - transform.position;
            lookPos.y = 0;
            var rotation = Quaternion.LookRotation(lookPos);
            transform.rotation = Quaternion.Slerp(transform.rotation, rotation, Time.deltaTime * damping);
        }
   }

   public void SetAnimClip(string animName)
   {
      GetComponent<Animator>().CrossFade(animName, 0.1f, 0, Random.Range(0.0f, 1.0f));
   }

}

Any suggestions?

Thanks.





jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: PlayAnimation.cs error CS1061:
« Reply #1 on: November 05, 2019, 02:12:36 AM »
Hi,

It's likely because of name clashing, I don't think namespace are used on his scripts and it could be the source of the problem.

but I am not sure I fully understand where is the conflict between playmaker and this file..

Have you gotten in touch with the author? I think we can work this out, but I would need to access to his asset to properly assess what's going on.

Bye,

 Jean

LaserSaber

  • Playmaker Newbie
  • *
  • Posts: 3
Re: PlayAnimation.cs error CS1061:
« Reply #2 on: November 05, 2019, 02:51:22 PM »
Yes, I first contacted the author.  Very helpful up until the point when it was understood that the errors were tagged "Playmaker".  Do you use Unity teams?  I could create a test project with Unity collaboration and send you an invite.  Thank you so much for your help.