Hey guys,
I am quite new to this unity scripting thing and have been trying to figure this out for several hours and still havent figured it out after trying to solve via researching google, youtube, unity tutorials. (I sort of figured it out but my methods seems clunky) If anyone can offer any insight i would greatly appreciate it.
Basically I have 2 object 1 cube and 1 cylinder. Both objects have animations on them that can be triggered by clicking on their respective objects. However I am trying to get the cylinder animation to be unplayable until the cube animation has finished.
I have manged to get it working however if I click on the cylinder before I click on the cube the animation for the cylinder will activate the moment the cube animation start and not wait for me to click on the cylinder.
For anyone able and interested in showing me what i have done wrong I have posted the 4 scripts i am using in the scene and have also pasted the main issue script here:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class cubeclick : MonoBehaviour {
private Vector3 startpos;
public cubemove _movement;
public cylinclick test;
void Start()
{
startpos = transform.position;
test.GetComponent().enabled =false;
}
void OnMouseDown()
{
if (Input.GetMouseButtonDown(0))
_movement.animation();
test.GetComponent().enabled = true;
}
}
2931928–216830–cubeclick.cs (555 Bytes)
2931928–216831–cylinclick.cs (451 Bytes)
2931928–216832–cylinmove.cs (224 Bytes)
2931928–216833–cubemove.cs (221 Bytes)