Forum rules - please read before posting.

Logo with link to my website

Hello ChrisIceBox,

I'm trying to do my game and I was able to put a title scene but I would like to know if it is possible for me to put into it a logo of my website and put a link for players to go to my website?

Best regards,
«1

Comments

  • Unity has a function called OpenURL that will open up a webpage - you can see it's Scripting Reference page here.

    You could easily incorporate this function into a custom Action, that gets called when you click on a Menu Button (see this tutorial).  Alternatively, you could place it in a script inside a public function, and then call that function by using the Object: Send message Action.
  • Thank you very much for your response, I will try and hope I get it right :)
  • Hi,

    I'm still trying to make that work but I'm just not able to do the first option. And for the alternative one, I don't understand what I should do. Also, would it be opening a new window in the browser?

    Do you thing you could guide me please?

    Do you think it would be possible to integrate such option in a future update?
  • Thing is, there's no end to what people may want for there own game - which is why custom Actions exist.  They make it very simple to integrate custom features such as this into your AC game, but the code itself is a separate issue, and not one inherent to AC.

    I'm confident that you could get the code you need (or at least help with it) by asking on the Unity forums.  Once you know what code you want to call from AC, write back here with it and I can help you link it into your AC game.
  • Hi Chris,

    I think I finally found the code. Here it is :

    using UnityEngine;
    using System.Collections;

    public class ExampleClass : MonoBehaviour {
        void Start() {
            Application.ExternalEval("window.open('http://mysite.com','_blank')");
        }
    }

    Hoping for that code to work and that you will be able to help me again.
  • OK - replace void Start() with "ublic void Interact(), and the link with your own website's link.

    Place the script as a component on an empty GameObject named Site, and you can then use the Object: Send message Action to run this function whenever you like.  Set the Object to affect as Site, and the Message to send as Interact, and the link will open when this Action is run.
  • edited September 2015

    Hi Chris,

    I tried the script and I get this error message from the console :

    StackOverflowException

    Do you happen to know what that means?

  • You would have to post the whole message for me to be able to give a proper answer, along with the relevant code that it's referencing (the console will tell you which lines in which scripts are causing the problem).

    Generally though it means you're causing a never-ending loop to run, causing a crash.  Does your ActionList only call the "Interact" message just the once?

    I meant "public" rather than "ublic" above - sorry, just saw that mistake.
  • Hi Chris,

    Here are some links to four screenshots I took.


    I hope I did it right..
  • Two things:
    • Be sure that the "Logo" gameobject has the "ExampleClass" script on it, and nothing else.
    • Does it work if you manually run the ActionList by clicking "Run" in it's Inspector?
  • Hi Chris,

    The gameobject has only the script on it.

    But I cannot find the option to Run the actionlist in it's inspector and I have a message on top stating that there's no MonoBehaviour in the file, or their names do not match the file name...
  • I'll need to see a screenshot of that message in full.

    What version of AC are you using?  The ability to run ActionLists manually was added some time ago - it should be to the right of the "Expand all" / "Collapse all" buttons near the top.
  • Hi Chris,

    I re-did everything this week-end and now I get another error... Here are screenshots of everything :

    I really hope we can get it to work...
  • Remove the [System.Serializable] from the custom script - you've adapted it from an Action script, but it's no longer an Action.
  • Even after removing  [System.Serializable] it gives me the exact same error...


  • Rename the file to "ExampleClass" - the filename needs to match the class definition inside it, as the top of it's Inspector points out.
  • Hi Chris,

    Sorry for the late reply.

    I did rename the file but it's still not working...
  • Not working in what way?  What is the error message?
  • Hi Chris,

    It was the same message. However, I was able to find someone that know code better than me and it's now working!
  • If you can, share with us.  ;)
    Maybe in a new thread in category "extending the editor".
    Thanks!
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.