Page MenuHomeFeedback Tracker

Issues with UI2Texture and loading savegames
New, NormalPublic

Description

When loading savegames applying textures using the "setObjectTexture" command starts to behave oddly when the UI2Texture feature is in play. At some point applying textures does not work anymore and it is stuck at the applied UI texture/display.

Details

Severity
Minor
Resolution
Open
Reproducibility
Always
Operating System
Windows 11 x64
Operating System Version
Latest
Category
Scripting
Steps To Reproduce

Here a script to add into init.sqf or similar for testing

[] spawn {
    private _createDisplayAndStoreTextures = {
        systemChat "Creating new display!";
        private _camoIndexes = ["camo","camo_1","camo_2","camo_3","camo01","camo1","camo1a","camo2","camo02","camo03","camo3","camo4","camo05","camo5","camo6","camo7","camo8","camo9","camo10"];
        private _container = uniformContainer player;
        private _textures = (_container getObjectTextures _camoIndexes) select {!isNil "_x"};
        if (_textures isEqualTo []) then {
            systemChat "could not get textures from contianer, getting it from unit";
            _textures = (_unit getObjectTextures _camoIndexes) select {!isNil "_x"};
        };
        _container setVariable ["textures", _textures];
        systemChat format ["Storing textures: %1", _textures];

        // spawn a helper object, the player needs to look at the object that gets the ui2texture display applied
        private _helperObject = createSimpleObject ["Sign_Sphere10cm_F", [0,0,0], true];
        _helperObject setObjectMaterial [0, "a3\structures_f_bootcamp\vr\coverobjects\data\vr_coverobject_basic.rvmat"];
        _helperObject setObjectScale 0.1;

        private _displayName = "dirt_textures§MyDisplay";
        private _displayDef = format ['#(argb,2048,2048,1)ui("RscDisplayEmpty","%1","ca")', _displayName];
        _helperObject setObjectTexture [0, _displayDef];

        waitUntil {
            _helperObject setPosASL (AGLToASL positionCameraToWorld [0,0.5,1]);
            !(isNull findDisplay _displayName)
        };
        systemChat "Found display";
        private _display = findDisplay _displayName;
        private _base = _display ctrlCreate ["RscPicture", 1];
        _base ctrlSetPosition [0, 0, 1, 1];
        _base  ctrlSetText "#(argb,8,8,1)color(1,0,0,1)";
        _base ctrlCommit 0;
        displayUpdate _display;

        player setVariable ["display", _display];
        player setVariable ["definition", _displayDef];
        _container setObjectTexture [0, _displayDef];
        deleteVehicle _helperObject;
    };
    sleep 1;
    while {alive player} do {
        private _container = uniformContainer player;
        systemChat "Applying display";
        if (isNull (player getVariable ["display", objNull])) then {
            [] call _createDisplayAndStoreTextures;
        } else {
            _container setObjectTexture [0, player getVariable "definition"];

            // just throwing this in here to show that this also wont be working anymore
            player setObjectTexture [0, player getVariable "definition"];
        };
        sleep 2;

        systemChat "Apply old textures to container";
        private _textures = _container getVariable "textures";
        {
            _container setObjectTexture [_forEachIndex, _x];
        } forEach _textures;

        sleep 2;
        systemChat "Apply old textures to unit as backup";
        // to show it does not work here either
        {
            player setObjectTexture [_forEachIndex, _x];
        } forEach _textures;

        sleep 2;
    };
};
  1. New mission
  2. Place player unit
  3. Add script into init.sqf or similar
  4. Observe unit turning red and then normal in a loop
  5. Save game when unit is read
  6. Load game
  7. Observe unit being pitch black (that is expected, display is kill, NOT THE ISSUE)
  8. Observe weird behavior on applying textures

First reapply of the old textures does not work, applying them again suddenly works, but as soon as a new display has been applied it is stuck on that display.

Additional Information

Launcher version: 1.5.152984

Game version: 2.20.152984

Branch: main / beta branch not specified

Event Timeline

diwako created this task.Tue, Jul 8, 11:18 AM
This comment was removed by LouMontana.