Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Corin_Ampelmann · Sep 15, 2019 at 09:10 PM · androidvector3oculustweencsv

Tween move from CSV works on Editor but not on Android

I've been working on a script to update the position and rotation from a cube. The script gets the rotation and position values from a CVS script, i convert the CSV data to a Vector3 List.
With DOtween I move the cube with the pos and rot values. The cubes moves in my unity editor but not on my Oculus quest build.

I can log the result in windows and unity
Android log:
Android Log Unity log:
Unity Log

This is my script i use for the animations:

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.UI;
 using System.IO;
 using DG.Tweening;
 
 public class CSVAndroid: MonoBehaviour
 {
     public string motionFile = "WaveMotions.csv";
     [Range (0.01f, 10f)]
     public float updateAfterXseconds = 1.0f;
     public List<Vector3> positionList = new List<Vector3>();
     public List<Vector3> rotationList = new List<Vector3>();
     public bool initialized = false;
     public List<string> csvList;
     public Text txt;
     public Text txt2;
     public bool _debugsOn = true;
 
     [Header ("Object Movement")]
     public Transform moveThisTransform;
     public Ease easeType = Ease.Linear;
     public bool localMovement = false;
     public bool swapYZpos = false;
     public bool loopData = true;
 
     //Local Vars
     private float secondTimer = 0f;
     private int counter = 0;
 
     private Vector3 goalPos = Vector3.zero;
     private Vector3 goalRot = Vector3.zero;
 
     void Awake()
     {
         csvList = new List<string> ();
         StartCoroutine(ReadStream());
         ParseCSVData();
 
     }
 
 
     void Update() {
     
             secondTimer += Time.deltaTime;
             if(secondTimer > updateAfterXseconds) {
                 secondTimer = 0f;
                 counter++;
                 StartTween();         
 
             } 
     }
 
     public IEnumerator ReadStream()
     {
     string filePath = System.IO.Path.Combine(Application.streamingAssetsPath, motionFile);
     string result = "";
 
 
     if (filePath.Contains("://"))
     {
         Debug.Log("Android_Log: Android Read Stream");
         UnityEngine.Networking.UnityWebRequest www = UnityEngine.Networking.UnityWebRequest.Get(filePath);
         yield return www.SendWebRequest();
         result = www.downloadHandler.text;
         txt2.text=result;
         Debug.Log("Android_Log: Android_Result " + result);
 
     }
     else {
         result = System.IO.File.ReadAllText(filePath);
         txt.text=result;
         Debug.Log("Android_Log: Windows_Result " + result);
         }
         
         using (TextReader reader = new StringReader(result))
         {
             string currentLine = reader.ReadLine ();
 
             while (!string.IsNullOrEmpty (currentLine)) {
                 csvList.Add(currentLine);
                 currentLine = reader.ReadLine ();
             }
         }
 
 
     }
     
     public void ParseCSVData() {        
         Debug.Log("Android_Log: Running ParseCSVData");
 
         for (int i = 1; i < csvList.Count; i++) {
 
             string[] stringSplit = csvList [i].Split(new char[] { ',' }, System.StringSplitOptions.None);
 
             if (!string.IsNullOrEmpty (stringSplit [0])) {
                 float id = float.Parse(stringSplit [0]);
 
                 float tempX = float.Parse(stringSplit [1]);
                 float tempY = 0f;
                 float tempZ = 0f;
                 if(!swapYZpos) {
                     tempY = float.Parse(stringSplit [2]);
                     tempZ = float.Parse(stringSplit [3]);
                 } else {
                     tempY = float.Parse(stringSplit [3]);
                     tempZ = float.Parse(stringSplit [2]);
                 }
 
                 Vector3 tempPos = new Vector3(tempX, tempY, tempZ);
 
                 float eulerX = float.Parse(stringSplit [4]);
                 float eulerY = float.Parse(stringSplit [5]);
                 float eulerZ = float.Parse(stringSplit [6]);
 
                 Vector3 tempRot = new Vector3(eulerX, eulerY, eulerZ);
 
                 positionList.Add(tempPos);
                 rotationList.Add(tempRot);        
 
             }
         }
         
 
     }
 
     public void StartTween() {
         
         if(counter < positionList.Count) {
             goalPos = positionList[counter];
             goalRot = rotationList[counter];
             if(_debugsOn)
                 Debug.Log("Android_Log: Counter:  <color=red>" + counter + "</color>  Position:  <color=orange>" + goalPos + "</color>  Rotation:  <color=green>" + goalRot + "</color>");
             if(!localMovement) {
                 moveThisTransform.DOMove(goalPos, updateAfterXseconds).SetEase(easeType);
                 moveThisTransform.DORotate(goalRot, updateAfterXseconds).SetEase(easeType);
             } else {
                 moveThisTransform.DOLocalMove(goalPos, updateAfterXseconds).SetEase(easeType);
                 moveThisTransform.DOLocalRotate(goalRot, updateAfterXseconds).SetEase(easeType);
             }
         } else {
                 counter = 0;
         }
     }
 
 
 }
 


windows-log.png (25.9 kB)
android-log.png (51.7 kB)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

263 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

[Crash] Unity with GearVR can crash after allowing permissions after first installation 1 Answer

Is there a way to get URP working with Oculus Integration? 1 Answer

Netcode not working on Quest 1 Answer

How to open a url in VR Browser from a Gear VR app? 1 Answer

Look and walk in VR unity 5.6.6 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges