Request for a tutorial:
Given:
A CSV file with some data in the Assets folder,
Want to use Playmaker for most of the things
Need:
Please guide me on the following.
I want to read values from the CSV
Do some stuff using the values
Then I want to edit some of the values using Playmaker/Easy Save
Overwrite/Save onto the same CSV file with new data
Thanks in advance
REQUEST EXAMPLES AND TUTORIALS HERE
Re: REQUEST EXAMPLES AND TUTORIALS HERE
Hi there,Mahesh0806 wrote: ↑Fri Jun 30, 2023 2:21 pm Request for a tutorial:
Given:
A CSV file with some data in the Assets folder,
Want to use Playmaker for most of the things
Need:
Please guide me on the following.
I want to read values from the CSV
Do some stuff using the values
Then I want to edit some of the values using Playmaker/Easy Save
Overwrite/Save onto the same CSV file with new data
Thanks in advance
It's not possible to load from the Assets folder at runtime because it won't exist in a compiled build. You can load data from Resources, but it's not possible to write to this location at runtime because Resources is compiled into the built player, so doesn't exist. The only place guaranteed to be writable at runtime is Unity's Application.persistentDataPath, so it would be necessary to place your file in Resources and then move it to the persistentDataPath.A CSV file with some data in the Assets folder
We have a general example for Saving and Loading CSV files here which might be helpful:
https://moodkie.com/forum/viewtopic.php?t=1888
As your example request is extremely specific we would only be able to create a project example for it if we come across other people with the same use case.
However, I can describe a workflow however which should work for you.
To move your CSV file from Resources to the persistent data path:
- Place your CSV file in a Resources folder (see https://learn.unity.com/tutorial/assets ... 002053b5a7).
- When your first scene loads, use the ES3 File Exists action with the location set to File to check whether the CSV file has been moved yet.
- If it has already been moved, you don't need to do the next steps. Otherwise...
- Use the ES3 Load Raw String action with the Location set to Resources to get the CSV file as a string.
- Use the ES3 Save Raw action with the Location set to File to save the string back to a file in the persistent data path.
https://moodkie.com/forum/viewtopic.php?t=1888
All the best,
Joel
-
- Posts: 4
- Joined: Fri Jun 30, 2023 1:08 pm
Re: REQUEST EXAMPLES AND TUTORIALS HERE
Thanks for the quick response,
Will it work for reading and writing the CSV?
If yes, how can I go about that?
Thanks,
Will it be possible if, I copy the CSV in a separate custom folder in Assets/ (and also in the build folder after built)It's not possible to load from the Assets folder at runtime because it won't exist in a compiled build.
Will it work for reading and writing the CSV?
If yes, how can I go about that?
Thanks,
Re: REQUEST EXAMPLES AND TUTORIALS HERE
The Assets folder isn't copied over to builds, so you would need to use the Resources folder as described.Will it be possible if, I copy the CSV in a separate custom folder in Assets/ (and also in the build folder after built)
Alternatively you can provide the Easy Save methods with an absolute path to anywhere on the file system that you have read/write permissions for. But as it will be an absolute path, this will only work on a system where that path is valid. For example C:/Users/Joel/MyFile.csv is only going to work on a computer with a user named Joel.
All the best,
Joel
-
- Posts: 4
- Joined: Fri Jun 30, 2023 1:08 pm
Re: REQUEST EXAMPLES AND TUTORIALS HERE
Actually, I want to read from and write to a CamData.csv file (As shown in the attached image).
I want to override the camera Position and Rotation values, in the CSV file using Playmaker + ES3.
The said CSV file is to be placed on some fixed path folder (e.g. Desktop for now)
I am using the Left and Right arrow keys to Jump/Switch to the Active Viewpoints. Any one of the ViewPoints will be active at a time.
And am using Mouse LeftClick to rotate and MiddleClick to PAN the Camera angle as I want.
Finally to record the camera angle I am using the R Key. This should record the current Camera angle data in the CSV file.
I can read the CSV file values and animate/set the camera accordingly. (Using Playmaker/ Datamaker CSV read actions)
My main need is how to record/write values in the said CSV file per active Viewpoint.
Please help.
I want to override the camera Position and Rotation values, in the CSV file using Playmaker + ES3.
The said CSV file is to be placed on some fixed path folder (e.g. Desktop for now)
I am using the Left and Right arrow keys to Jump/Switch to the Active Viewpoints. Any one of the ViewPoints will be active at a time.
And am using Mouse LeftClick to rotate and MiddleClick to PAN the Camera angle as I want.
Finally to record the camera angle I am using the R Key. This should record the current Camera angle data in the CSV file.
I can read the CSV file values and animate/set the camera accordingly. (Using Playmaker/ Datamaker CSV read actions)
My main need is how to record/write values in the said CSV file per active Viewpoint.
Please help.
- Attachments
-
- Screenshot 2023-07-19 at 11.59.06 AM.jpg (79.22 KiB) Viewed 7893 times
Re: REQUEST EXAMPLES AND TUTORIALS HERE
Hi there,
Unfortunately I can only help with the aspects which are specific to Easy Save, and we can only create sample scenes which will be helpful to multiple people rather than ones which are only very specific to a single person's project.
However, you can find an example of the general usage of the PlayMaker CSV actions here which should indicate how you could incorporate it into your project:
https://moodkie.com/forum/viewtopic.php?t=1888
Let me know in General Discussion if you have any other questions relating to this.
All the best,
Joel
Unfortunately I can only help with the aspects which are specific to Easy Save, and we can only create sample scenes which will be helpful to multiple people rather than ones which are only very specific to a single person's project.
However, you can find an example of the general usage of the PlayMaker CSV actions here which should indicate how you could incorporate it into your project:
https://moodkie.com/forum/viewtopic.php?t=1888
Let me know in General Discussion if you have any other questions relating to this.
All the best,
Joel
-
- Posts: 4
- Joined: Fri Jun 30, 2023 1:08 pm
Re: REQUEST EXAMPLES AND TUTORIALS HERE
Thank you,
I tried again as mentioned in your example. With some minor tweaks, it worked for me.
Thank you very much for your quick reply.
Enjoying Easy Save 3
I tried again as mentioned in your example. With some minor tweaks, it worked for me.
Thank you very much for your quick reply.
Enjoying Easy Save 3
![Very Happy :D](./images/smilies/icon_e_biggrin.gif)
Re: REQUEST EXAMPLES AND TUTORIALS HERE
Glad that helpedMahesh0806 wrote: ↑Wed Jul 19, 2023 11:42 am Thank you,
I tried again as mentioned in your example. With some minor tweaks, it worked for me.
Thank you very much for your quick reply.
Enjoying Easy Save 3![]()
![Smile :)](./images/smilies/icon_e_smile.gif)