REQUEST EXAMPLES AND TUTORIALS HERE

Examples using PlayMaker. Note that to view these examples, you will need to have purchased PlayMaker.
Mahesh0806
Posts: 4
Joined: Fri Jun 30, 2023 1:08 pm

Re: REQUEST EXAMPLES AND TUTORIALS HERE

Post by Mahesh0806 »

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
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: REQUEST EXAMPLES AND TUTORIALS HERE

Post by Joel »

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
Hi there,
A CSV file with some data in the Assets folder
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.

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:
  1. Place your CSV file in a Resources folder (see https://learn.unity.com/tutorial/assets ... 002053b5a7).
  2. 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.
  3. If it has already been moved, you don't need to do the next steps. Otherwise...
  4. Use the ES3 Load Raw String action with the Location set to Resources to get the CSV file as a string.
  5. 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.
Now the file has been moved to the persistent data path, we can load from it and save to it from there, as showing in the Saving and Loading CSV files example:

https://moodkie.com/forum/viewtopic.php?t=1888

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Mahesh0806
Posts: 4
Joined: Fri Jun 30, 2023 1:08 pm

Re: REQUEST EXAMPLES AND TUTORIALS HERE

Post by Mahesh0806 »

Thanks for the quick response,
It's not possible to load from the Assets folder at runtime because it won't exist in a compiled build.
Will it be possible if, I copy the CSV in a separate custom folder in Assets/ (and also in the build folder after built)
Will it work for reading and writing the CSV?
If yes, how can I go about that?

Thanks,
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: REQUEST EXAMPLES AND TUTORIALS HERE

Post by Joel »

Will it be possible if, I copy the CSV in a separate custom folder in Assets/ (and also in the build folder after built)
The Assets folder isn't copied over to builds, so you would need to use the Resources folder as described.

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
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Mahesh0806
Posts: 4
Joined: Fri Jun 30, 2023 1:08 pm

Re: REQUEST EXAMPLES AND TUTORIALS HERE

Post by Mahesh0806 »

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.
Attachments
Screenshot 2023-07-19 at 11.59.06 AM.jpg
Screenshot 2023-07-19 at 11.59.06 AM.jpg (79.22 KiB) Viewed 6102 times
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: REQUEST EXAMPLES AND TUTORIALS HERE

Post by Joel »

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
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Mahesh0806
Posts: 4
Joined: Fri Jun 30, 2023 1:08 pm

Re: REQUEST EXAMPLES AND TUTORIALS HERE

Post by Mahesh0806 »

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 :D
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: REQUEST EXAMPLES AND TUTORIALS HERE

Post by Joel »

Mahesh0806 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 :D
Glad that helped :)
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Post Reply