Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Silicon Power on September 21, 2019, 10:43:12 AM

Title: Is there any action to get Texture2D from an object and store in a variable?
Post by: Silicon Power on September 21, 2019, 10:43:12 AM
Hi. Is there any action to get Texture2D from an object and store inside a texture variable?

Title: Re: Is there any action to get Texture2D from an object and store in a variable?
Post by: djaydino on September 21, 2019, 01:39:53 PM
Hi.
I know that there are get sprite actions.

Maybe 'Material Get Texture'
Title: Re: Is there any action to get Texture2D from an object and store in a variable?
Post by: Silicon Power on September 21, 2019, 02:24:46 PM
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.
Title: Re: Is there any action to get Texture2D from an object and store in a variable?
Post by: djaydino on September 21, 2019, 07:13:08 PM
Hi.
Is it on a object or inside a material?

What kind of object is it?
Title: Re: Is there any action to get Texture2D from an object and store in a variable?
Post by: Silicon Power on September 22, 2019, 12:53:44 AM
Hi.
Is it on a object or inside a material?

What kind of object is it?

It's on an object. Like below pic.
Title: Re: Is there any action to get Texture2D from an object and store in a variable?
Post by: djaydino on September 22, 2019, 05:01:34 AM
Hi.
Mean on wich component (on a Game Object) .
You are now showing the variable (object type Texture2d) :)
Title: Re: Is there any action to get Texture2D from an object and store in a variable?
Post by: Silicon Power on September 22, 2019, 05:44:33 AM
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.
Title: Re: Is there any action to get Texture2D from an object and store in a variable?
Post by: djaydino on September 22, 2019, 02:19:31 PM
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.)
Title: Re: Is there any action to get Texture2D from an object and store in a variable?
Post by: Silicon Power on September 22, 2019, 04:43:52 PM
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.
Title: Re: Is there any action to get Texture2D from an object and store in a variable?
Post by: Silicon Power on September 25, 2019, 06:35:26 PM
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.
Title: Re: Is there any action to get Texture2D from an object and store in a variable?
Post by: Broken Stylus 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).
Title: Re: Is there any action to get Texture2D from an object and store in a variable?
Post by: Silicon Power on October 03, 2019, 01:08:32 PM
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?
Title: Re: Is there any action to get Texture2D from an object and store in a variable?
Post by: Broken Stylus on October 04, 2019, 11:01:49 AM
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?
Title: Re: Is there any action to get Texture2D from an object and store in a variable?
Post by: Silicon Power on October 04, 2019, 04:07:52 PM
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.
(https://hutonggames.com/playmakerforum/index.php?action=dlattach;topic=21118.0;attach=14661)
Title: Re: Is there any action to get Texture2D from an object and store in a variable?
Post by: Broken Stylus on October 05, 2019, 11:57:23 AM
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.
Title: Re: Is there any action to get Texture2D from an object and store in a variable?
Post by: Silicon Power on July 27, 2021, 11:15:55 AM
Hi. Is there any action to get Texture2D from an object and store inside a texture variable?

I still have this problem! Isn't really a way to get a texture 2D from object variable and save inside a texture variable?