playMaker

Author Topic: Is there any action to get Texture2D from an object and store in a variable?  (Read 4040 times)

Silicon Power

  • Full Member
  • ***
  • Posts: 186
Hi. Is there any action to get Texture2D from an object and store inside a texture variable?


djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Hi.
I know that there are get sprite actions.

Maybe 'Material Get Texture'

Silicon Power

  • Full Member
  • ***
  • Posts: 186
Hi.
I know that there are get sprite actions.

Maybe 'Material Get Texture'

Unfortunately doesn't work in this case. Seems there is no action for getting Texture2D from an Object.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Hi.
Is it on a object or inside a material?

What kind of object is it?

Silicon Power

  • Full Member
  • ***
  • Posts: 186
Hi.
Is it on a object or inside a material?

What kind of object is it?

It's on an object. Like below pic.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Hi.
Mean on wich component (on a Game Object) .
You are now showing the variable (object type Texture2d) :)

Silicon Power

  • Full Member
  • ***
  • Posts: 186
Hi.
Mean on wich component (on a Game Object) .
You are now showing the variable (object type Texture2d) :)

I want to save this Texture2D value inside a texture variable.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Hi.
So you mean to convert the Texture 2d to a Texture variable?

Most i find on unity answers is to convert to Sprite.

Are you getting the Texture2d from a external source?

If the Texture2d is in your project folder, you can change the type btw :)

Sorry if i misunderstood :D (or still misunderstanding, if so can you give more details where you are getting the Texture2d etc.)

Silicon Power

  • Full Member
  • ***
  • Posts: 186
Hi.
So you mean to convert the Texture 2d to a Texture variable?

Most i find on unity answers is to convert to Sprite.

Are you getting the Texture2d from a external source?

If the Texture2d is in your project folder, you can change the type btw :)

Sorry if i misunderstood :D (or still misunderstanding, if so can you give more details where you are getting the Texture2d etc.)

It's an asset that creates icon form a 3d model in runtime and save the result into Texture2D inside an Object.
Now I need to convert this Texture 2D to a Texture variable so then I can use it for Unity UI system.

Silicon Power

  • Full Member
  • ***
  • Posts: 186
I'm still stuck on this! Can somebody please create this action? I mean an action to get Texture2D from object and save inside a Texture variable.

Broken Stylus

  • Beta Group
  • Hero Member
  • *
  • Posts: 772
Re: Is there any action to get Texture2D from an object and store in a variable?
« Reply #10 on: September 30, 2019, 07:29:45 AM »
Looks like you need to extract the data of the t2d texture into a regular texture type.
Something similar to what is shown here:


What's the aspect of this "object" your plugin creates?
Is it already a uGUI raw image?
In this case data might be extracted in PM with the appropriate action.

Are you sure the texture data is definitely saved as a texture2d?

Oddly, I have a Texture 2D To PNG String action, somehow related to EasySave (that's a plugin) but the file can't be found and there's a path-related error involved there (it's looking for some C:/Projects/... on a Mac).

Silicon Power

  • Full Member
  • ***
  • Posts: 186
Looks like you need to extract the data of the t2d texture into a regular texture type.
Something similar to what is shown here:


What's the aspect of this "object" your plugin creates?
Is it already a uGUI raw image?
In this case data might be extracted in PM with the appropriate action.

Are you sure the texture data is definitely saved as a texture2d?

Oddly, I have a Texture 2D To PNG String action, somehow related to EasySave (that's a plugin) but the file can't be found and there's a path-related error involved there (it's looking for some C:/Projects/... on a Mac).

Hi. thanks for trying to help. it's a free asset you can't find in the asset store.
https://assetstore.unity.com/packages/tools/camera/runtime-preview-generator-112860

Can you please create a PlayMaker action for this?

Broken Stylus

  • Beta Group
  • Hero Member
  • *
  • Posts: 772
When you use it, do you at least know where this t2d is saved? Is it put in cache or is turned into a real asset or object you can pick and interact with?

Silicon Power

  • Full Member
  • ***
  • Posts: 186
When you use it, do you at least know where this t2d is saved? Is it put in cache or is turned into a real asset or object you can pick and interact with?

Please look at below pic. It stores there inside an object variable.


Broken Stylus

  • Beta Group
  • Hero Member
  • *
  • Posts: 772
Sure, you created a FsmObject variable of Texture2D type, but the plugin would not know how to save the t2d into this Playmaker variable.
That's why I am trying to see if the plugin actually produces an element in the scene, game object, asset, else, which you might point to from Playmaker.
Other than that, I'm not sure your problem can be solved. Someone who can code for well might have a clue.