Forum rules - please read before posting.

Change cursor through action list mid scene

hi,

i would like to change the cursor to a ‘wait’ cursor when specific events happen in my game. These are not cutscenes.

is her an easy way to do this that I’m missing?

Comments

  • The Wait cursor only shows when gameplay is blocked.  You can, however, change the Main cursor graphic through script.  To get an API reference to it (for use in a custom script), right-click the texture field in the Cursor Manager:

    AC.KickStarter.cursorManager.pointerIcon.texture

  • Hi,

    I had a HideCursor script made for me, but am not sure how to change this to change the cursor to this:

    AC.KickStarter.cursorManager.GetCursorIconFromID (4).texture

    when my menu 'Loading' is on, here is my HideCursor script:


    using UnityEngine;
    using System.Collections;

    public class ChangeCursor : MonoBehaviour {


    private Texture normalTexture;


    private void Start ()
    {
    normalTexture = AC.KickStarter.cursorManager.pointerIcon.texture;
    }


    private void Update ()
    {
    float mouseHeight = Input.mousePosition.y;
    float screenHeight = Screen.height;

    if (mouseHeight / screenHeight < 0.33f)
    {
    // Show cursor
    AC.KickStarter.cursorManager.pointerIcon.texture = normalTexture;
    }
    else
    {
    // Hide cursor
    AC.KickStarter.cursorManager.pointerIcon.texture = null;    
    }
    }

    private void OnDestroy ()
    {
    // Show cursor
    AC.KickStarter.cursorManager.pointerIcon.texture = normalTexture;
    }

    }

    Can you or anyone help?

    Thanks!
  • You need to rely on the OnMenuTurnOn / OnMenuTurnOff events to trigger code when your Loading menu turns on:


    For more, see the Manual's "Menu scripting" chapter.

  • Fantastic! Do I then attach this to a game object in any scene and run once?
  • No - it's a runtime script and will run itself.  Place it either in all scenes that the Loading menu can turn on, or attach it to your PersistentEngine.
  • Hi,

    I have attached it to the Persistent Engine but the cursor is not changing.

    See images of Persistent Engine, Loading Menu, Calling Loading Menu and Cursor:

    https://www.dropbox.com/sh/t92ytvbb2acnh0t/AAB2fHiRfmgVvaPzluJ6di1Ra?dl=0

    Thanks

    James
  • Are you relying on Hardware or Cursor rendering?  Does it work if you switch to the other option?
  • It is Software. Cursor rendering. And do you mean does it work if i change the script to a different cursor number (3) eg?
  • rather than AC.KickStarter.cursorManager.GetCursorIconFromID (4).texture

  • No - I mean if you're using Software and switch to Hardware.

    What cursor is actually showing?  The regular Main cursor, or the Cutscene cursor?
  • Not switching to hardware, all my cursors are in the Cursor manager, and I don't have a cursor image in the Cutscene Cursor.I just want the script to replace the main cursor with my cursor that is icon ID 4 Shen Loading menu is turned on.
    AC.KickStarter.cursorManager.GetCursorIconFromID (4).texture
  • Again: What cursor is actually showing?  If you have no Cutscene cursor - is the main cursor showing, or is none showing due to a Cutscene running at the time?

    Assign a Cutscene cursor - what happens then?

  • HI, the main cursor is showing. and this same cursor is set as my cutscene cursor. The cursor: AC.KickStarter.cursorManager.GetCursorIconFromID (4).texture
    is listed in my interaction cursors as 'wait'. And this is the cursor I want the main cursor to change to when menu Loading is turned on
  • edited September 2018
    Assign a different cursor as your cutscene cursor - we need to be able to tell the difference.  Does this different cursor show when the loading menu is turned on?

    Place Debug statements in your OnMenuTurnOn and OnMenuTurnOff events - are they kicking in?
  • got this working thanks!
  • However, it won't animate like my other cursors. It is an 8x8 sprite sheet cursor, identical to my other cursor spritesheets, set to texture type cursor. How can I change my script to ensure it animates?
  • Actually, it dissent change back once my command to turn Loading menu off. Also, I have to untick my Loading menu to Start Game Locked Off too
  • You made no mention of needing to animate the cursor as well.  If you need to transfer animation data, you can do that through script at the same time by transferring it's numFrames / numRows variables - and reset the animation with:

    AC.KickStarter.cursorManager.pointerIcon.isAnimated = true;
    AC.KickStarter.cursorManager.pointerIcon.Reset ();
    AC.KickStarter.cursorManager.pointerIcon.ClearCache ();
    AC.KickStarter.cursorManager.pointerIcon.ClearSprites ();
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.