public static GameObject CreateIU(Model3dARC arc, Transform parentSpace, GameObject prefab) { _gameObject = Instantiate(prefab, new Vector3(), Quaternion.identity); _gameObject.name = "3dARC"; _gameObject.tag = "arc"; _gameObject.transform.SetParent(parentSpace.transform); _gameObject.transform.localPosition = arc.GetPos(); _gameObject.transform.localRotation = arc.GetRotation(); _gameObject.transform.localScale = arc.GetScale(); _gameObject.GetComponent <Apply3dModel>().ApplyModel(arc.GetLink(), _gameObject.transform); return(_gameObject); }
public static GameObject CreateIU(Model3dARC arc, Transform parentSpace, GameObject prefab) { _gameObject = Instantiate(prefab, new Vector3(), Quaternion.identity); _gameObject.name = "3dARC"; _gameObject.tag = "arc"; _gameObject.transform.SetParent(parentSpace.transform); _gameObject.transform.localPosition = arc.GetPos(); _gameObject.transform.localRotation = arc.GetRotation(); _gameObject.transform.localScale = arc.GetScale(); Animation animation = _gameObject.GetComponent <Animation>(); animation.playAutomatically = false; animation.wrapMode = WrapMode.Loop; Debug.Log("Searching for animation clip by name '" + arc.GetAnimationClip() + "'"); AnimationClip clip = animation.GetClip(arc.GetAnimationClip()); if (clip != null) { Debug.Log("Play animation clip '" + arc.GetAnimationClip() + "'"); animation.Play(clip.name); } else { Debug.Log("No animation clip by name '" + arc.GetAnimationClip() + "' is found in this game object, searching in Assets folder"); for (int i = 0; i < InformationViewController.clips.Length; i++) { clip = InformationViewController.clips[i]; if (clip.name.Trim().Equals(arc.GetAnimationClip())) { Debug.Log("Animation clip '" + arc.GetAnimationClip() + "' is found in Assets folder"); Debug.Log("Adding animation clip '" + arc.GetAnimationClip() + "' and play"); clip.legacy = true; animation.AddClip(clip, clip.name); animation.Play(clip.name); break; } } } return(_gameObject); }