Mostly Harmless

UE2:Create a ScriptedTexture

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search
The "New Material" dialog in UnrealEd 3.

You can create the ScriptedTexture(U2, U2XMP, UE2Runtime, UT2003, UT2004) either statically with UnrealEd 3 or dynamically in UnrealScript.

In UnrealEd[edit]

Use this method if you need a texture e.g. for a CameraTextureClient(U2, UE2Runtime, UT2003, UT2004).

  1. Open the Texture Browser.
  2. Select File -> New... from the browser's menu.
  3. Specify a target package and texture name, optionally also a group name.
  4. Use the factory class "Raw Material".
  5. Set the MaterialClass in the factory properties to ScriptedTexture (class'Engine.ScriptedTexture').
  6. Click New.
  7. The ScriptedTexture properties window should open automatically. Set the desired dimensions via UClamp and VClamp there.

As usual, unless you put it in myLevel, you need to save the package.

In UnrealScript[edit]

A ScriptedTexture can be created with the following code snippet:

local ScriptedTexture ST;
 
ST = new class'ScriptedTexture';
ST.SetSize(SizeX, SizeY);
ST.Client = someActor;

This creates a new ScriptedTexture that is SizeX pixels wide and SizeY high that is rendered through the RenderTexture() event of someActor.

Note that this example may waste resources if the ScriptedTexture will only be used for a limited duration. The UT2004 Hellbender (Onslaught.ONSPRV) provides a more efficient example for this case, using the global ObjectPool(U2, U2XMP, UE2Runtime, UT2003, UT2004) to allocate and release the ScriptedTexture used for the license plate.