playMaker

Author Topic: Finding the path to a texture  (Read 1711 times)

playsteven

  • Junior Playmaker
  • **
  • Posts: 75
Finding the path to a texture
« on: October 16, 2015, 05:37:36 AM »
Hi,

I'm currently writing some actions for Prime31 android plug-ins.

A roadblock has been hit. I'm attempting to pass a texture to post on Twitter (Social Networking plug-in).

This is the code from Prime31 which tweets a screengrab ...

Code: [Select]
public static string screenshotFilename = "someScreenshot.png";
Application.CaptureScreenshot( screenshotFilename );
var pathToImage = Application.persistentDataPath + "/" + screenshotFilename;
var bytes = System.IO.File.ReadAllBytes( pathToImage );
TwitterAndroid.postStatusUpdate( "This is going on twitter", bytes );

Any ideas on how I can adapt this for my Playmaker action, so I can use an FsmTexture in place of the screenshot used above?

Do I need to get the path to the FsmTexture to allow me to post the image? I played around with AssetDatabase.GetAssetPath() but, honestly, I didn't have a clue what I was doing  :o

Thanks,
Steven

dudebxl

  • Hero Member
  • *****
  • Posts: 602
Re: Finding the path to a texture
« Reply #1 on: October 16, 2015, 11:58:48 AM »
what will be in the texture? a screenshot or a fixed texture like a logo.

if logo, then it should be in the resource folder (string pathToImage = "Assets/Resources/.../xxx.png") or Resources.Load

if screenshot then just use the path of the saved png file (check out the camerascreenshot action for more path codes) or use bytes = texture.Value.EncodeToPNG() ;

something like that, you need to play around and test..

hard without trying myself in mono but hope it helps.

playsteven

  • Junior Playmaker
  • **
  • Posts: 75
Re: Finding the path to a texture
« Reply #2 on: October 17, 2015, 07:03:30 AM »
Thanks for the info. I'm going to be using a fixed texture, it is a logo.

I'll try out your suggestions next week :)